Make failure in unions commutative
Right now, because of how _rearrange was implemented, a union with a subset of attributes of another union could be united with it, but not viceversa. This change makes both operations fail, hence making the union commutative again. Correct unions were always commutative.
This commit is contained in:
parent
696361af4b
commit
7e61120beb
@ -117,7 +117,7 @@ class Relation (object):
|
||||
raise TypeError('Expected an instance of the same class')
|
||||
elif self.header == other.header:
|
||||
return other
|
||||
elif self.header.sharedAttributes(other.header) == len(self.header):
|
||||
elif len(self.header) == len(other.header) and self.header.sharedAttributes(other.header) == len(self.header):
|
||||
return other.projection(self.header)
|
||||
raise TypeError('Relations differ: [%s] [%s]' % (
|
||||
','.join(self.header), ','.join(other.header)
|
||||
|
Loading…
x
Reference in New Issue
Block a user