def test_copy_2(self): # change to the range are isolated x = LinearScale() y = x.copy() x.range([1, 2]) self.assertEqual(x.invert(1), 0) self.assertEqual(y.invert(1), 1) self.assertEqual(y.range(), [0, 1]) y.range([2, 3]) self.assertEqual(x.invert(2), 1) self.assertEqual(y.invert(2), 0) self.assertEqual(x.range(), [1, 2]) self.assertEqual(y.range(), [2, 3])
def test_copy_2(self): # change to the range are isolated x = LinearScale() y = x.copy() x.range([1, 2]) self.assertEqual(x.invert(1), 0) self.assertEqual(y.invert(1), 1) self.assertEqual(y.range(), [0, 1]) y.range([2, 3]) self.assertEqual(x.invert(2), 1) self.assertEqual(y.invert(2), 0) self.assertEqual(x.range(), [1, 2]) self.assertEqual(y.range(), [2, 3])
def test_range_1(self): # defaults to [0, 1] x = LinearScale() self.assertEqual(x.range(), [0, 1]) self.assertAlmostEqual(x.invert(0.5), 0.5)
def test_range_1(self): # defaults to [0, 1] x = LinearScale() self.assertEqual(x.range(), [0, 1]) self.assertAlmostEqual(x.invert(0.5), 0.5)