Skip to content

Commit 1617540

Browse files
bug fix in Union
1 parent 0b45f5b commit 1617540

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

datajoint/relational_operand.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ def __init__(self, arg=None):
605605
def create(cls, arg1, arg2):
606606
obj = cls()
607607
if inspect.isclass(arg2) and issubclass(arg2, RelationalOperand):
608-
obj = obj() # instantiate if a class
608+
arg2 = arg2() # instantiate if a class
609609
if not isinstance(arg1, RelationalOperand) or not isinstance(arg2, RelationalOperand):
610610
raise DataJointError('a relation can only be unioned with another relation')
611611
if arg1.connection != arg2.connection:

tests/test_relational_operand.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def test_join():
132132

133133
@staticmethod
134134
def test_issue_463():
135-
assert_equal(((A & B) * B).fetch().size, len(A*B))
135+
assert_equal(((A & B) * B).fetch().size, len(A * B))
136136

137137

138138
@staticmethod
@@ -153,10 +153,10 @@ def test_project():
153153

154154
@staticmethod
155155
def test_union():
156-
x = set(zip(*IJ().fetch('i','j')))
157-
y = set(zip(*JI().fetch('i','j')))
156+
x = set(zip(*IJ.fetch('i','j')))
157+
y = set(zip(*JI.fetch('i','j')))
158158
assert_true(len(x) > 0 and len(y) > 0 and len(IJ() * JI()) < len(x)) # ensure the IJ and JI are non-trivial
159-
z = set(zip(*(IJ() + JI()).fetch('i','j'))) # union
159+
z = set(zip(*(IJ + JI).fetch('i','j'))) # union
160160
assert_set_equal(x.union(y), z)
161161

162162
@staticmethod
@@ -168,7 +168,7 @@ def test_preview():
168168

169169
@staticmethod
170170
def test_heading_repr():
171-
x = A() * D()
171+
x = A * D
172172
s = repr(x.heading)
173173
assert_equal(len(list(1 for g in s.split('\n') if g.strip() and not g.strip().startswith(('-', '#')))),
174174
len(x.heading.attributes))

0 commit comments

Comments
 (0)