コード例 #1
0
 def test_Noneid(self):
     """This function tests for None argument"""
     Base.reset_objects()
     b1 = Base(None)
     self.assertEqual(b1.id, 1)
 def test_id(self):
     b1 = Base()
     self.assertEqual(b1.id, 1)
コード例 #3
0
 def test_id_positive(self):
     b4 = Base(12)
     self.assertEqual(b4.id, 12)
 def test_id_str(self):
     """ test string case """
     self.b1 = Base("testing")
     self.assertEqual(self.b1.id, "testing")
 def test_id_tup(self):
     """ test tuple case """
     self.b1 = Base((1, 2, 3))
     self.assertEqual(self.b1.id, (1, 2, 3))
 def test_id_int(self):
     """ test integer case """
     self.b1 = Base(1)
     self.assertEqual(self.b1.id, 1)
 def test_id_neg(self):
     """ test negative case """
     self.b1 = Base(-1)
     self.assertEqual(self.b1.id, -1)
コード例 #8
0
 def test_none(self):
     """test none and empty"""
     g = Base(None)
     self.assertEqual(2, g.id)
     g = Base()
     self.assertEqual(3, g.id)
コード例 #9
0
 def test_1arg(self):
     b = Base(2)
     self.assertEqual(2, b.id)
コード例 #10
0
 def test_str(self):
     """test strings"""
     e = Base("6")
     self.assertEqual("6", e.id)
     e = Base("666")
     self.assertEqual("666", e.id)
コード例 #11
0
 def test_class(self):
     """test class type"""
     f = Base()
     self.assertFalse(isinstance(type(f), Base))
コード例 #12
0
 def test_floats(self):
     """test floats"""
     d = Base(6.66)
     self.assertEqual(6.66, d.id)
     d = Base(-6.66)
     self.assertEqual(-6.66, d.id)
コード例 #13
0
 def test_int(self):
     """test integer"""
     c = Base(666)
     self.assertEqual(666, c.id)
 def test_id(self):
     '''tests for consecutive auto id assignments'''
     b1 = Base()
     b2 = Base()
     b3 = Base()
     self.assertTrue(b1.id == 1 and b2.id == 2 and b3.id == 3)
コード例 #15
0
 def test_base_dict(self):
     """ test dict """
     B = Base({"Holberton": "School"})
     self.assertEqual(B.id, {"Holberton": "School"})
コード例 #16
0
 def test_base_zero_args(self):
     """ test args for our base """
     B = Base(1)
     self.assertEqual(B.id, 1)
 def test_id_empty(self):
     """ test empty case """
     self.b1 = Base()
     self.assertEqual(self.b1.id, 1)
コード例 #18
0
 def test_base_negative(self):
     """ test negative """
     B = Base(-1)
     self.assertEqual(B.id, -1)
 def test_id_zero(self):
     """ test zero case """
     self.b1 = Base(0)
     self.assertEqual(self.b1.id, 0)
コード例 #20
0
 def test_base_int(self):
     """ test int """
     B = Base(53)
     self.assertEqual(B.id, 53)
 def test_id_float(self):
     """ test the float case """
     self.b1 = Base(1.2)
     self.assertEqual(self.b1.id, 1.2)
コード例 #22
0
 def test_base_string(self):
     """ test str """
     B = Base("fares")
     self.assertEqual(B.id, "fares")
 def test_id_list(self):
     """ test list case """
     self.b1 = Base([1, 2, 3])
     self.assertEqual(self.b1.id, [1, 2, 3])
コード例 #24
0
 def test_base_none(self):
     """ test None """
     B = Base(None)
     self.assertEqual(B.id, 1)
 def test_id_dict(self):
     """ test dictionary case """
     self.b1 = Base({'a': 1, 'b': 2})
     self.assertEqual(self.b1.id, {'a': 1, 'b': 2})
コード例 #26
0
 def test_base_float(self):
     """ test float """
     B = Base(3.14)
     self.assertEqual(B.id, 3.14)
コード例 #27
0
 def test_id_None(self):
     b1 = Base()
     self.assertEqual(b1.id, 1)
     b2 = Base()
     self.assertEqual(b2.id, 2)
コード例 #28
0
 def test_base_list(self):
     """ test list """
     B = Base([1, 2, 3, 4])
     self.assertEqual(B.id, [1, 2, 3, 4])
コード例 #29
0
 def test_id_negative(self):
     b5 = Base(-2)
     self.assertEqual(b5.id, -2)
     b6 = Base(-4)
     self.assertEqual(b6.id, -4)
コード例 #30
0
 def test_instancecreationwithstringid(self):
     """This function tests for one instance creation with id"""
     Base.reset_objects()
     b1 = Base("foo")
     self.assertEqual(b1.id, "foo")