コード例 #1
0
 def test_root_string(self):
     self.assertEqual('Invalid input', calc.root(1, '1'))
コード例 #2
0
 def test_root_string_2(self):
     self.assertEqual('Invalid input', calc.root('1', 1))
コード例 #3
0
 def test_float_root_exact(self):
     self.assertEquals(2.5, calc.root(6.25, 2))
コード例 #4
0
 def test_float_root_almost(self):
     self.assertAlmostEquals(2.2360679775, calc.root(5, 2), places=5)
コード例 #5
0
 def test_root_zero_y(self):
     self.assertEqual('Invalid input', calc.root(1, 0))
コード例 #6
0
 def test_root_zero_x(self):
     self.assertEqual(0, calc.root(0, 1))
コード例 #7
0
 def test_root_float_y(self):
     self.assertEqual('Invalid input', calc.root(27, 3.5))
コード例 #8
0
 def test_root_negative_even(self):
     self.assertEqual('Invalid input', calc.root(-27, 2))
コード例 #9
0
 def test_root_negative(self):
     self.assertEqual(-3, calc.root(-27, 3))
コード例 #10
0
 def test_root(self):
     self.assertEqual(3, calc.root(27, 3))
コード例 #11
0
 def test_complex_sqrt(self):
     self.assertEqual(root(-4, 2), Complex(1, 2))