Beispiel #1
0
 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)
Beispiel #2
0
 def test_delete(self):
     unit1 = SiamObj('1', '2', a=1)
     unit2 = SiamObj('1', '2', a=1)
     unit3 = SiamObj('2', '2', a=1)
     pool = unit3.pool
     self.assertEqual(2, len(pool),
                      'Wrong number of instances of SiamObj class')
     del unit3
     self.assertEqual(1, len(pool), "Delete didn't work")
Beispiel #3
0
 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')
Beispiel #4
0
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)
Beispiel #5
0
 def test_equal(self):
     self.unit1 = SiamObj("1", 22, c=33)
     self.unit2 = SiamObj("1", 22, c=33)
     self.assertEqual(self.unit1, self.unit2)
Beispiel #6
0
 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)
Beispiel #7
0
 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)
Beispiel #8
0
 def test_not_same_instance(self):
     unit1 = SiamObj('1', '2', a=1)
     unit3 = SiamObj('2', '2', a=1)
     self.assertNotEqual(unit1, unit3, 'Must not be the same instance')
Beispiel #9
0
 def test_same_instance(self):
     unit1 = SiamObj('1', '2', a=1)
     unit2 = SiamObj('1', '2', a=1)
     self.assertEqual(unit1, unit2, 'Must be the same instance')
Beispiel #10
0
 def test_notEqual(self):
     unit1 = SiamObj('1', '2', a=1)
     unit3 = SiamObj('2', '2', a=1)
     self.assertNotEqual(unit1, unit3)
Beispiel #11
0
 def test_isEqual(self):
     unit1 = SiamObj('1', '2', a=1)
     unit2 = SiamObj('1', '2', a=1)
     self.assertEqual(unit1, unit2)