Skip to content

Commit d0ca6a6

Browse files
committed
- Removed error throw for uniting parts with missing masters
- Added test case for #927
1 parent a91f239 commit d0ca6a6

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

datajoint/dependencies.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ def unite_master_parts(lst):
2626
# move from the ith position to the (j+1)th position
2727
lst[j+1:i+1] = [name] + lst[j+1:i]
2828
break
29-
else:
30-
raise DataJointError("Found a part table {name} without its master table.".format(name=name))
3129
return lst
3230

3331

tests/test_declare.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,37 @@ def test_dependencies():
160160
assert_set_equal(set(s.full_table_name for s in channel.parents(primary=True, as_objects=True)),
161161
{ephys.full_table_name})
162162

163+
@staticmethod
164+
def test_descendants_only_contain_part_table():
165+
"""issue #927"""
166+
167+
@schema
168+
class A(dj.Manual):
169+
definition = """
170+
a: int
171+
"""
172+
173+
@schema
174+
class B(dj.Manual):
175+
definition = """
176+
-> A
177+
b: int
178+
"""
179+
180+
@schema
181+
class Master(dj.Manual):
182+
definition = """
183+
table_master: int
184+
"""
185+
186+
class Part(dj.Part):
187+
definition = """
188+
-> master
189+
-> B
190+
"""
191+
192+
assert A.descendants() == ['`djtest_test1`.`a`', '`djtest_test1`.`b`', '`djtest_test1`.`master__part`']
193+
163194
@staticmethod
164195
@raises(dj.DataJointError)
165196
def test_bad_attribute_name():

0 commit comments

Comments
 (0)