def test_contained_row(): g = Geomatcher() assert g.contained("RoW") == [] assert g.contained("RoW", include_self=True, only=["RoW"]) == ["RoW"] assert 'RoW' not in g.contained("GLO", only=['NO', 'RoW']) assert 'RoW' not in g.contained("GLO") assert 'RoW' not in g.contained(("ecoinvent", "RAS"), only=['NO', 'LT', 'RoW'])
def test_contained(): g = Geomatcher() expected = [ 'US', ('ecoinvent', 'US-ASCC'), ('ecoinvent', 'US-NPCC'), ('ecoinvent', 'US-HICC'), ('ecoinvent', 'US-WECC'), ('ecoinvent', 'US-SERC'), ('ecoinvent', 'US-RFC'), ('ecoinvent', 'US-FRCC'), ('ecoinvent', 'US-MRO'), ('ecoinvent', 'US-SPP') ] assert g.contained("US")[:5] == expected[:5] expected.pop(0) assert g.contained("US", include_self=False)[:5] == expected[:5] assert g.contained("US", include_self=False, exclusive=True)[:5] == expected[:5] assert g.contained("US", biggest_first=False, include_self=False)[-1] == ('ecoinvent', 'US-ASCC') expected = [ 'US', ('ecoinvent', 'US-ASCC'), ('ecoinvent', 'US-NPCC'), ('ecoinvent', 'US-HICC'), ('ecoinvent', 'US-WECC'), ] only = [ ('ecoinvent', 'US-WECC'), 'US', ('ecoinvent', 'US-NPCC'), ('ecoinvent', 'US-ASCC'), ('ecoinvent', 'US-HICC'), ] assert g.contained("US", only=only) == expected