def test_intersects(): g = Geomatcher() expected = [ 'GLO', ('ecoinvent', 'UN-AMERICAS'), ('ecoinvent', 'RLA'), ('ecoinvent', 'UN-CARIBBEAN'), ] assert g.intersects("CU") == expected assert g.intersects("CU", exclusive=True) == ['GLO'] expected = [ ('ecoinvent', 'UN-CARIBBEAN'), ('ecoinvent', 'RLA'), ('ecoinvent', 'UN-AMERICAS'), 'GLO', ] assert g.intersects("CU", biggest_first=False) == expected only = [ ('ecoinvent', 'RLA'), ('ecoinvent', 'UN-AMERICAS'), ] expected = [ ('ecoinvent', 'UN-AMERICAS'), ('ecoinvent', 'RLA'), ] assert g.intersects("CU", only=only) == expected
def test_intersects_row(): g = Geomatcher() assert g.intersects("RoW") == [] assert g.intersects("RoW", include_self=True) == [] assert g.intersects("RoW", include_self=True, only=['NO', 'LT', "RoW"]) == ["RoW"] assert g.intersects(('ecoinvent', 'NORDEL'), only=["NO", "RoW"]) == ["NO"] assert g.intersects("NO", only=["NO", "RoW"], include_self=True, exclusive=True) == ["NO"] assert g.intersects("NO", only=["NO", "RoW"], include_self=True, exclusive=False) == ["NO"] assert g.intersects(('ecoinvent', 'BALTSO'), include_self=False, exclusive=True, only=['RoW', 'EE', 'LT', 'LV']) == ['EE', 'LT', 'LV'] assert g.intersects(('ecoinvent', 'BALTSO'), include_self=False, exclusive=True, only=['RoW', 'LT', 'LV']) == ['LT', 'LV']