class SiamMetaTest(unittest.TestCase): def test_equal(self): self.unit1 = SiamObj("1", 22, c=33) self.unit2 = SiamObj("1", 22, c=33) self.assertEqual(self.unit1, self.unit2) def test_not_equal(self): self.unit1 = SiamObj("1", 22, d=33) self.unit2 = SiamObj("1", d=33) self.unit3 = SiamObj(0, "11", p=15) self.assertNotEqual(self.unit1, self.unit3) self.assertNotEqual(self.unit1, self.unit2) def test_connec_method(self): self.unit1 = SiamObj(1, 2, q=12) self.unit2 = SiamObj(1, 2, z=4) self.unit3 = SiamObj(1, 2, z=4) self.unit1.connect(1, 2, z=4).z = 100 self.assertEqual(self.unit2.z, 100) self.assertEqual(self.unit3.z, 100) def test_pool_method(self): self.unit2 = SiamObj(a=2) self.unit3 = SiamObj(a=3) pool = self.unit3.pool del self.unit3 self.assertEqual(len(pool), 1)
def test_connect(self): unit1 = SiamObj('1', '2', a=1) unit2 = SiamObj('1', '2', a=1) unit3 = SiamObj('2', '2', a=1) unit3.connect('1', '2', 1).a = 2 self.assertEqual(2, unit1.a, 'Attribute of instance is not assigned to value') self.assertEqual(2, unit2.a, 'Attribute of instance is not assigned to value')