Exemplo n.º 1
0
 def test_do_stuff(self):
     '''
     verify is a number
     '''
     test_param = 10
     result = do_stuff(test_param)
     self.assertEqual(result, 15)
Exemplo n.º 2
0
 def test_do_stuff(self):
     '''
     hi
     '''
     test_param = 10
     result = script.do_stuff(test_param)
     self.assertEqual(result, 15)
Exemplo n.º 3
0
 def test_do_stuff3(self):
     test_param = '10'
     result = script.do_stuff(test_param)
     self.assertEqual(result, 15)
Exemplo n.º 4
0
 def test_do_stuff(self):
     """Hii!!!"""
     test_param = 10
     # Call function to test
     result = script.do_stuff(test_param)
     self.assertEqual(result, 15)
Exemplo n.º 5
0
 def test_do_stuff4(self):
     test_param = ""
     # Call function to test
     result = script.do_stuff(test_param)
     self.assertEqual(result, "Please enter number")
Exemplo n.º 6
0
 def test_do_stuff5(self):
     test_param = 0
     result = script.do_stuff(test_param)
     self.assertEqual(result, 5)  # expected result is 5
Exemplo n.º 7
0
 def test_do_stuff2(self):
     test_param = 'gdfghs'
     result = script.do_stuff(test_param)
     self.assertIsInstance(
         result, ValueError
     )  # expected result this sholdn't work, we retun an instance of ValueError class
Exemplo n.º 8
0
 def test_do_stuff3(self):
     test_param = None
     result = script.do_stuff(test_param)
     self.assertEqual(result, 'please enter a number')
Exemplo n.º 9
0
 def test_do_stuff3(self):  # name of function in main9
     test_param = [3, 4]
     result = script.do_stuff(test_param)
     # self.assertTrue(isinstance(result, TypeError))
     self.assertIsInstance(result, TypeError)
Exemplo n.º 10
0
 def test_do_stuff2(self):  # name of function in main9
     test_param = 'jejweg'
     result = script.do_stuff(test_param)
     # or better, use assertIsInstance
     self.assertTrue(isinstance(result, ValueError))
Exemplo n.º 11
0
 def test_do_stuff(self):
     '''helloo'''  # should be one line and it will shown in terminal when run unittest with -v flag, this runs before setUp method
     test_param = 10
     result = script.do_stuff(test_param)
     self.assertEqual(result, 15)  # expected result is 10+5=15
Exemplo n.º 12
0
 def test_do_stuff(self):
     '''test numbers'''
     test_num = 10
     result = script.do_stuff(test_num)
     self.assertEqual(result, 15)
Exemplo n.º 13
0
 def test_do_stuff3(self):
     '''test none and else'''
     test_num = None
     result = script.do_stuff(test_num)
     self.assertIsNone(result, None)
Exemplo n.º 14
0
 def test_do_stuff2(self):
     '''test strings'''
     test_num = 'abc'
     result = script.do_stuff(test_num)
     self.assertIsInstance(result, ValueError)
Exemplo n.º 15
0
 def test_do_stuff2(self):
     test_param = ' jahsdfjhadskjf'
     result = script.do_stuff(test_param)
     self.assertIsInstance(result, ValueError)
Exemplo n.º 16
0
 def test_do_stuff2(self):
     test_param = 'sshkhs'
     result = script.do_stuff(test_param)
     self.assertIsInstance(result, ValueError)
Exemplo n.º 17
0
 def test_do_stuff6(self):
     test_param = 4
     result = script.do_stuff(test_param)
     self.assertEqual(result, 9)
Exemplo n.º 18
0
 def test_do_stuff7(self):
     test_param = 0
     result = script.do_stuff(test_param)
     self.assertEqual(result, 5)
Exemplo n.º 19
0
 def test_do_stuff(self):  # name of function in main9
     '''Hi! Comments can be added to tests so you can see them when running the tests.'''
     test_param = 10
     result = script.do_stuff(test_param)
     self.assertEqual(result, 15)
Exemplo n.º 20
0
 def test_do_stuff4(self):
     test_param = ''
     result = script.do_stuff(test_param)
     self.assertEqual(result, 'please enter number')
Exemplo n.º 21
0
 def test_do_stuff2(self):
     test_param = "dget"
     # Call function to test
     result = script.do_stuff(test_param)
     self.assertIsInstance(result, ValueError)
Exemplo n.º 22
0
 def test_do_stuff(self):
     test_param = 10
     result = script.do_stuff(test_param)
     self.assertEqual(result, 15)  # expected result is 10+5=15
Exemplo n.º 23
0
 def test_do_stuff2(self):
     test_param = 'nnifenin'
     result = do_stuff(test_param)
     self.assertEqual(isinstance(result, ValueError), True)
     self.assertTrue(isinstance(result, ValueError))
     self.assertIsInstance(result, ValueError)