def test_copy_3(self): # changes to clamping are isolated x = LinearScale().clamp(True) y = x.copy() x.clamp(False) self.assertEqual(x(2), 2) self.assertEqual(y(2), 1) self.assertTrue(y.clamp()) y.clamp(False) self.assertEqual(x(2), 2) self.assertEqual(y(2), 2) self.assertFalse(x.clamp())
def test_copy_3(self): # changes to clamping are isolated x = LinearScale().clamp(True) y = x.copy() x.clamp(False) self.assertEqual(x(2), 2) self.assertEqual(y(2), 1) self.assertTrue(y.clamp()) y.clamp(False) self.assertEqual(x(2), 2) self.assertEqual(y(2), 2) self.assertFalse(x.clamp())
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_1(self): # changes to the domain are isolated x = LinearScale() y = x.copy() x.domain([1, 2]) self.assertEqual(y.domain(), [0, 1]) self.assertEqual(x(1), 0) self.assertEqual(y(1), 1) y.domain([2, 3]) self.assertEqual(x(2), 1) self.assertEqual(y(2), 0) self.assertEqual(x.domain(), [1, 2]) self.assertEqual(y.domain(), [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_copy_1(self): # changes to the domain are isolated x = LinearScale() y = x.copy() x.domain([1, 2]) self.assertEqual(y.domain(), [0, 1]) self.assertEqual(x(1), 0) self.assertEqual(y(1), 1) y.domain([2, 3]) self.assertEqual(x(2), 1) self.assertEqual(y(2), 0) self.assertEqual(x.domain(), [1, 2]) self.assertEqual(y.domain(), [2, 3])