Example #1
0
 def test_is_square_with_negative_input_raises_overflow_error(self):
     for x in (-1, -5, -33):
         with self.assertRaises(OverflowError):
             is_square(x)
Example #2
0
 def test_is_square_with_large_input(self):
     for x in (123**2, 1234**2, 12345**2):
         self.assertTrue(is_square(x))
Example #3
0
 def test_is_not_square_with_large_input(self):
     for x in (123**2-5, 1234**2+5, 12345**2+100):
         self.assertFalse(is_square(x))
Example #4
0
 def test_first_ten_non_squares_are_non_square(self):
     for x in (2, 3, 5, 6, 7, 8, 10, 11, 12, 13):
         self.assertFalse(is_square(x))
Example #5
0
 def test_first_ten_squares_are_squares(self):
     for x in (0, 1, 4, 9, 16, 25, 36, 49, 64, 81):
         self.assertTrue(is_square(x))
Example #6
0
 def test_is_square_with_negative_input_raises_overflow_error(self):
     for x in (-1, -5, -33):
         with self.assertRaises(OverflowError):
             is_square(x)
Example #7
0
 def test_is_not_square_with_large_input(self):
     for x in (123**2 - 5, 1234**2 + 5, 12345**2 + 100):
         self.assertFalse(is_square(x))
Example #8
0
 def test_is_square_with_large_input(self):
     for x in (123**2, 1234**2, 12345**2):
         self.assertTrue(is_square(x))
Example #9
0
 def test_first_ten_squares_are_squares(self):
     for x in (0, 1, 4, 9, 16, 25, 36, 49, 64, 81):
         self.assertTrue(is_square(x))
Example #10
0
 def test_first_ten_non_squares_are_non_square(self):
     for x in (2, 3, 5, 6, 7, 8, 10, 11, 12, 13):
         self.assertFalse(is_square(x))