@@ -35,11 +35,11 @@ def schema_empty_module(schema_any, schema_empty):
35
35
classes in schema_any, after running `spawn_missing_classes`.
36
36
"""
37
37
namespace_dict = {
38
- '_' : schema_any ,
39
- ' schema' : schema_empty ,
40
- ' Ephys' : Ephys ,
38
+ "_" : schema_any ,
39
+ " schema" : schema_empty ,
40
+ " Ephys" : Ephys ,
41
41
}
42
- module = types .ModuleType (' schema_empty' )
42
+ module = types .ModuleType (" schema_empty" )
43
43
44
44
# Add classes to the module's namespace
45
45
for k , v in namespace_dict .items ():
@@ -50,11 +50,10 @@ def schema_empty_module(schema_any, schema_empty):
50
50
51
51
@pytest .fixture
52
52
def schema_empty (connection_test , schema_any ):
53
- context = {
54
- ** schema .LOCALS_ANY ,
55
- "Ephys" : Ephys
56
- }
57
- schema_empty = dj .Schema (PREFIX + "_test1" , context = context , connection = connection_test )
53
+ context = {** schema .LOCALS_ANY , "Ephys" : Ephys }
54
+ schema_empty = dj .Schema (
55
+ PREFIX + "_test1" , context = context , connection = connection_test
56
+ )
58
57
schema_empty (Ephys )
59
58
# load the rest of the classes
60
59
schema_empty .spawn_missing_classes (context = context )
@@ -93,12 +92,18 @@ def test_namespace_population(schema_empty_module):
93
92
setattr (schema_empty_module , k , v )
94
93
95
94
for name , rel in getmembers (schema , relation_selector ):
96
- assert hasattr (schema_empty_module , name ), "{name} not found in schema_empty" .format (name = name )
97
- assert rel .__base__ is getattr (schema_empty_module , name ).__base__ , "Wrong tier for {name}" .format (name = name )
95
+ assert hasattr (
96
+ schema_empty_module , name
97
+ ), "{name} not found in schema_empty" .format (name = name )
98
+ assert (
99
+ rel .__base__ is getattr (schema_empty_module , name ).__base__
100
+ ), "Wrong tier for {name}" .format (name = name )
98
101
99
102
for name_part in dir (rel ):
100
103
if name_part [0 ].isupper () and part_selector (getattr (rel , name_part )):
101
- assert getattr (rel , name_part ).__base__ is dj .Part , "Wrong tier for {name}" .format (name = name_part )
104
+ assert (
105
+ getattr (rel , name_part ).__base__ is dj .Part
106
+ ), "Wrong tier for {name}" .format (name = name_part )
102
107
103
108
104
109
def test_undecorated_table ():
@@ -125,7 +130,6 @@ class A(dj.Manual):
125
130
class B (dj .Part ):
126
131
definition = ...
127
132
128
-
129
133
with pytest .raises (dj .DataJointError ):
130
134
schema_any (A .B )
131
135
schema_any (A )
@@ -136,7 +140,9 @@ def test_unauthorized_database(db_creds_test):
136
140
an attempt to create a database to which user has no privileges should raise an informative exception.
137
141
"""
138
142
with pytest .raises (dj .DataJointError ):
139
- dj .Schema ("unauthorized_schema" , connection = dj .conn (reset = True , ** db_creds_test ))
143
+ dj .Schema (
144
+ "unauthorized_schema" , connection = dj .conn (reset = True , ** db_creds_test )
145
+ )
140
146
141
147
142
148
def test_drop_database (db_creds_test ):
@@ -150,9 +156,7 @@ def test_drop_database(db_creds_test):
150
156
151
157
152
158
def test_overlapping_name (connection_test ):
153
- test_schema = dj .Schema (
154
- PREFIX + "_overlapping_schema" , connection = connection_test
155
- )
159
+ test_schema = dj .Schema (PREFIX + "_overlapping_schema" , connection = connection_test )
156
160
157
161
@test_schema
158
162
class Unit (dj .Manual ):
0 commit comments