Ejemplo n.º 1
0
def test_superset_subset_for_nested_unions() -> None:
    x = ValueSet(1)
    y = ValueSet(2)
    z = ValueSet(3)
    xy = Union(x, y)
    yz = Union(y, z)
    xz = Union(x, z)
    xyz = Union(x, Union(y, z))

    for a in [x, y, z, xy, yz, xz, xyz]:
        for b in [x, y, z, xy, yz, xz, xyz]:
            if a != b:
                assert not a.is_equivalent_to(b)

    assert xyz.is_superset_of(x)
    assert xyz.is_superset_of(y)
    assert xyz.is_superset_of(z)
    assert xyz.is_superset_of(xy)
    assert xyz.is_superset_of(yz)
    assert xyz.is_superset_of(xz)

    assert x.is_subset_of(xyz)
    assert y.is_subset_of(xyz)
    assert z.is_subset_of(xyz)
    assert xy.is_subset_of(xyz)
    assert yz.is_subset_of(xyz)
    assert xz.is_subset_of(xyz)
Ejemplo n.º 2
0
def test_superset_subset_for_nested_intersections() -> None:
    x = ValueSet(1)
    y = ValueSet(2)
    z = ValueSet(3)
    xy = Intersection(x, y)
    yz = Intersection(y, z)
    xz = Intersection(x, z)
    xyz = Intersection(x, Intersection(y, z))

    assert xyz.is_subset_of(x)
    assert xyz.is_subset_of(y)
    assert xyz.is_subset_of(z)
    assert xyz.is_subset_of(xy)
    assert xyz.is_subset_of(yz)
    assert xyz.is_subset_of(xz)

    assert x.is_superset_of(xyz)
    assert y.is_superset_of(xyz)
    assert z.is_superset_of(xyz)
    assert xy.is_superset_of(xyz)
    assert yz.is_superset_of(xyz)
    assert xz.is_superset_of(xyz)

    assert not xyz.is_superset_of(x)
    assert not xyz.is_superset_of(y)
    assert not xyz.is_superset_of(z)
    assert not xyz.is_superset_of(xy)
    assert not xyz.is_superset_of(yz)
    assert not xyz.is_superset_of(xz)

    assert not x.is_subset_of(xyz)
    assert not y.is_subset_of(xyz)
    assert not z.is_subset_of(xyz)
    assert not xy.is_subset_of(xyz)
    assert not yz.is_subset_of(xyz)
    assert not xz.is_subset_of(xyz)