1
- import datajoint as dj
2
1
from datajoint import errors
3
2
from pytest import raises
4
3
from datajoint .dependencies import unite_master_parts
5
- from .schema import *
6
4
7
5
8
6
def test_unite_master_parts ():
@@ -50,22 +48,10 @@ def test_unite_master_parts():
50
48
]
51
49
52
50
53
- def test_nullable_dependency (schema_any ):
51
+ def test_nullable_dependency (thing_tables ):
54
52
"""test nullable unique foreign key"""
55
53
# Thing C has a nullable dependency on B whose primary key is composite
56
- a = ThingA ()
57
- b = ThingB ()
58
- c = ThingC ()
59
-
60
- # clear previous contents if any.
61
- c .delete_quick ()
62
- b .delete_quick ()
63
- a .delete_quick ()
64
-
65
- a .insert (dict (a = a ) for a in range (7 ))
66
-
67
- b .insert1 (dict (b1 = 1 , b2 = 1 , b3 = 100 ))
68
- b .insert1 (dict (b1 = 1 , b2 = 2 , b3 = 100 ))
54
+ _ , _ , c , _ , _ = thing_tables
69
55
70
56
# missing foreign key attributes = ok
71
57
c .insert1 (dict (a = 0 ))
@@ -79,23 +65,10 @@ def test_nullable_dependency(schema_any):
79
65
assert len (c ) == len (c .fetch ()) == 5
80
66
81
67
82
- def test_unique_dependency (schema_any ):
68
+ def test_unique_dependency (thing_tables ):
83
69
"""test nullable unique foreign key"""
84
-
85
70
# Thing C has a nullable dependency on B whose primary key is composite
86
- a = ThingA ()
87
- b = ThingB ()
88
- c = ThingC ()
89
-
90
- # clear previous contents if any.
91
- c .delete_quick ()
92
- b .delete_quick ()
93
- a .delete_quick ()
94
-
95
- a .insert (dict (a = a ) for a in range (7 ))
96
-
97
- b .insert1 (dict (b1 = 1 , b2 = 1 , b3 = 100 ))
98
- b .insert1 (dict (b1 = 1 , b2 = 2 , b3 = 100 ))
71
+ _ , _ , c , _ , _ = thing_tables
99
72
100
73
c .insert1 (dict (a = 0 , b1 = 1 , b2 = 1 ))
101
74
# duplicate foreign key attributes = not ok
0 commit comments