def test_clone(self): domain = VariableDomain('d', 'd', [1, 2, 3, 4]) v = ExternalVariable('v', domain, value=1) v_clone = v.clone() self.assertEqual(v_clone.name, 'v') self.assertEqual(v_clone.domain, domain) self.assertEqual(v_clone.value, 1)
def test_clone(self): domain = VariableDomain("d", "d", [1, 2, 3, 4]) v = ExternalVariable("v", domain, value=1) v_clone = v.clone() self.assertEqual(v_clone.name, "v") self.assertEqual(v_clone.domain, domain) self.assertEqual(v_clone.value, 1)
def test_clone_cb(self): domain = VariableDomain('d', 'd', [1, 2, 3, 4]) v = ExternalVariable('v', domain, value=1) cb = MagicMock() cb_clone = MagicMock() v.subscribe(cb) v_clone = v.clone() v_clone.subscribe(cb_clone) v_clone.value = 3 self.assertFalse(cb.called) cb_clone.assert_called_with(3)