def testEqualWithConstantDifferentValueNegative(self): variable1 = VariableBuilder().value(3.0).build() variable2 = Mock() variable2.value = 2.0 variable2.dispatch = Mock( side_effect=lambda x: x.visit_constant(variable2)) self.assertFalse(variable1.equal(variable2)) self.assertNotEqual(variable1, variable2)
def testClon(self): variable1 = VariableBuilder().build() variable2 = variable1.clon() self.assertFalse(variable1 is variable2) self.assertTrue(variable1.equal(variable2))
def testEqualNegativeValueAndName(self): variable1 = VariableBuilder().name('x').value(3.0).build() variable2 = VariableBuilder().name('y').value(3.1).build() self.assertFalse(variable1.equal(variable2)) self.assertNotEqual(variable1, variable2)
def testEqualPositive(self): variable1 = VariableBuilder().name('x').value(3.0).build() variable2 = VariableBuilder().name('x').value(3.0).build() self.assertTrue(variable1.equal(variable2))