def test_add_definitions(): g = Geomatcher({}) given = { 'A': {1, 2, 3}, 'B': {2, 3, 4}, } g.add_definitions(given, "foo", False) assert ("foo", "A") in g.topology assert g.faces == {1, 2, 3, 4} assert "NO" not in g assert "GLO" not in g
def test_add_definitions_relative(): given = { 'A': {1, 2, 3}, 'B': {2, 3, 4}, } extra = { 'C': ['A', 'B'] } g = Geomatcher(given) g.add_definitions(extra, "foo") assert g.topology[("foo", "C")] == {1, 2, 3, 4} assert 'A' in g.topology assert "NO" not in g assert "GLO" not in g
from .IMAGE import IMAGE_TOPOLOGY from constructive_geometries import Geomatcher geomatcher = Geomatcher() geomatcher.add_definitions(IMAGE_TOPOLOGY, "IMAGE", relative=True)