예제 #1
0
 def test_power_int(self):
     self.assertEqual(power_num(2, 3), 8)
예제 #2
0
 def test_for_zero_as_number_and_zero_power(self):
     self.assertEqual(power_num(0, 0), 1)
예제 #3
0
 def test_for_zero_as_number_and_negative_power(self):
     with self.assertRaises(ZeroDivisionError):
         power_num(0, -2)
예제 #4
0
 def test_for_zero_as_number_and_positive_power(self):
     self.assertEqual(power_num(0, 2), 0)
예제 #5
0
 def test_for_negative_numbers(self):
     with self.assertRaises(TypeError):
         power_num(-6, 2)
예제 #6
0
 def test_for_power_as_float(self):
     with self.assertRaises(TypeError):
         power_num(6, 2.2)
예제 #7
0
 def test_for_list_as_number(self):
     with self.assertRaises(TypeError):
         power_num([], 2)
예제 #8
0
 def test_power_float(self):
     self.assertEqual(power_num(1.5, 2), 2.25)