コード例 #1
0
 def test_CaseI(self):
     n = 3
     p = 5
     excepted = 243
     myCalculator = Solution.Calculator()
     try:
         actual = myCalculator.power(n, p)
         self.assertEqual(excepted, actual)
     except:
         self.assertFail()
コード例 #2
0
 def test_CaseIV(self):
     n = -1
     p = 3
     excepted = "n and p should be non-negative"
     myCalculator = Solution.Calculator()
     try:
         actual = myCalculator.power(n, p)
         self.assertFail()
     except Exception as e:
         self.assertEqual(excepted, str(e))
コード例 #3
0
 def test_CaseI(self):
     n = 25
     my_calculator = Solution.Calculator()
     actual = my_calculator.divisorSum(n)
     excepted = 31
     self.assertEqual(actual, excepted)