示例#1
0
 def test_create_object(self):
     self.assertEqual(entities.TestObj(1, 'a'), m2m.create_object(1, 'a'))
     self.assertNotEqual(entities.TestObj(1, 'a'),
                         m2m.create_object(2, 'a'))
示例#2
0
 def test_catch_explode(self):
     obj = entities.TestObj(10, 'abcdef')
     self.assertTrue(m2m.catch_explode(obj))
示例#3
0
 def test_no_catch_explode(self):
     obj = entities.TestObj(10, 'abcdef')
     with self.assertRaises(Exception):
         m2m.no_catch_explode(obj)
示例#4
0
 def test_md5(self):
     obj = entities.TestObj(10, 'abcdef')
     self.assertEqual('e80b5017098950fc58aad83c8c14978e', m2m.md5(obj))
示例#5
0
 def test_fibinacci(self):
     obj = entities.TestObj(10, 'a')
     self.assertEqual(34, m2m.fibonacci(obj))
示例#6
0
 def test_list_of_clones(self):
     obj = entities.TestObj(10, 'a')
     self.assertEqual([obj, obj, obj], m2m.list_of_clones(obj, 3))
示例#7
0
 def test_clone(self):
     obj = entities.TestObj(10, 'a')
     self.assertEqual(obj, m2m.clone(obj))
     self.assertNotEqual(obj, m2m.clone(obj, 2))
示例#8
0
 def test_num_times_string(self):
     obj = entities.TestObj(10, 'a')
     self.assertEqual('a' * 10, m2m.num_times_string(obj))