コード例 #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
ファイル: record.py プロジェクト: DRMacIver/glassbox
    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))