Esempio n. 1
0
 def testExplanation(self):
     result = primeChecker(32)
     self.assertFalse(result[0])
     expected_explanation = "2 times 16 is 32"
     self.assertEqual(result[1], expected_explanation)
     result = primeChecker(582)
     expected_explanation = '2 times 291 is 582'
     self.assertEqual(result[1], expected_explanation)
Esempio n. 2
0
 def testNonPrimes(self):
   # 1 digit
   result = primeChecker(8)
   self.assertFalse(result[0])
   # 2 digit
   result = primeChecker(33)
   self.assertFalse(result[0])
   # 3 digit
   result = primeChecker(112)
   self.assertFalse(result[0])
Esempio n. 3
0
 def testPrimes(self):
   # 1 digit
   result = primeChecker(7)
   self.assertTrue(result[0])
   # 2 digit
   result = primeChecker(31)
   self.assertTrue(result[0])
   # 3 digit
   result = primeChecker(113)
   self.assertTrue(result[0])
Esempio n. 4
0
 def testPrimes(self):
   # 1 digit
   result = primeChecker(7)
   self.assertTrue(result[0])
   # 2 digit
   result = primeChecker(31)
   self.assertTrue(result[0])
   # 3 digit
   result = primeChecker(113)
   self.assertTrue(result[0])
Esempio n. 5
0
 def testNonPrimes(self):
   # 1 digit
   result = primeChecker(8)
   self.assertFalse(result[0])
   # 2 digit
   result = primeChecker(33)
   self.assertFalse(result[0])
   # 3 digit
   result = primeChecker(112)
   self.assertFalse(result[0])
Esempio n. 6
0
 def testExplanation(self):
   result = primeChecker(32)
   self.assertFalse(result[0])
   expected_explanation = "2 times 16 is 32"
   self.assertEqual(result[1], expected_explanation)
Esempio n. 7
0
 def testNonPrimes(self):
     result = primeChecker(8)
     self.assertFalse(result[0])
     result = primeChecker(582)
     self.assertFalse(result[0])