Esempio n. 1
0
def test_discrete_mapping_from_string():
    m = DiscreteMapping.from_string('string_map("1":"f","2":"m")')
    assert m.map_dict == {"1": "f", "2": "m"}
    # And let's get trickier
    m = DiscreteMapping.from_string(
        r'string_map("1\"": "f" , "2" :"m")')
    assert m.map_dict == {r'1"': "f", "2": "m"}
Esempio n. 2
0
def test_discrete_mapping_transform():
    m = DiscreteMapping({"1": "f", "2": "m"})
    assert m.transform("1") == "f"
    assert m.transform("2") == "m"
    assert m.transform("3") == ""