Esempio n. 1
0
def test_good_mappings():
    sets = [
        ((1, 5), (1, 5)),
        ((1, 5), (5, 1)),
        ((1, 5), (2, 6)),
        ((1, 5), (0, 10))
    ]
    for inrange, outrange in sets:
        m = LinearMapping(inrange, outrange)
        assert m.transform(inrange[0]) == outrange[0]
        assert m.transform(inrange[1]) == outrange[1]
Esempio n. 2
0
def test_linear_mapping_strings():
    m = LinearMapping((1, 5), (2, 6))
    assert m.transform('1') == 2