def test_3(self): t = Transformation(1, 0, 1, 0, 1, 1) p = 0, 0 pt = t.transform(p) self.assertEqual(1.0, pt[0]) self.assertEqual(1.0, pt[1]) ptt = t.untransform(pt) self.assertEqual(0.0, ptt[0]) self.assertEqual(0.0, ptt[1])
def test_transformation_1_0_1(): """ Test transformation for (1, 0, 1, ...). """ t = Transformation(1, 0, 1, 0, 1, 1) p = 0, 0 pt = t.transform(p) assert 1.0 == pt[0] assert 1.0 == pt[1] ptt = t.untransform(pt) assert 0.0 == ptt[0] assert 0.0 == ptt[1]
def test_transformation_identity(): """ Test identity transformation. """ t = Transformation(1, 0, 0, 0, 1, 0) p = 1, 1 pt = t.transform(p) assert 1.0 == pt[0] assert 1.0 == pt[1] ptt = t.untransform(pt) assert 1.0 == pt[0] assert 1.0 == pt[1]
def web_mercator(): wm = WebMercator(10) wm.transformation = Transformation(1, 0, 0, 0, 1, 0) return wm