示例#1
0
    def __or__(self, other):
        if not isinstance(other, Record):
            raise TypeError("Cannot union Record with %r of type %s" %
                            (other, other.__name__))

        if len(other.labels) > len(self.labels):
            self, other = other, self
        if other.contained_in(self):
            return self

        return Record(merge_arrays(self.labels, other.labels))
示例#2
0
    def __or__(self, other):
        if not isinstance(other, Record):
            raise TypeError("Cannot union Record with %r of type %s" % (
                other, other.__name__
            ))

        if len(other.labels) > len(self.labels):
            self, other = other, self
        if other.contained_in(self):
            return self

        return Record(
            merge_arrays(self.labels, other.labels)
        )
示例#3
0
def test_merges_correctly(x, y):
    t = merge_arrays(x, y)
    assert list(t) == sorted(set(x) | set(y))
示例#4
0
def test_merges_correctly(x, y):
    t = merge_arrays(x, y)
    assert list(t) == sorted(set(x) | set(y))