Пример #1
0
def test_numbers():

    try:
        response = is_prime(1)
        assert response == False
    except Exception as err:
        print(err)

    try:
        response = is_prime(2)
        assert response == True
    except Exception as err:
        print(err)

    try:
        response = is_prime(3.14)
    except Exception as err:
        print(err)
Пример #2
0
 def test_raises(self):
     with self.assertRaises(ValueError):
         is_prime(0)
         is_prime(3.14)
         is_prime('Hello')
Пример #3
0
 def test_numbers(self):
     self.assertEqual(is_prime(2), True)
     self.assertEqual(is_prime(8), False)
     self.assertEqual(is_prime(1), False)
     self.assertEqual(is_prime(83), True)
     self.assertEqual(is_prime(self.fixture), False)
Пример #4
0
 def test_raises(self):
     with self.assertRaises(ValueError):
         is_prime(-1)
Пример #5
0
 def test_numbers(self):
     self.assertEqual(is_prime(100), False)
Пример #6
0
def test_is_prime():
    response = is_prime(1)
    assert response == False
Пример #7
0
def test_numbers():
    response = is_prime(1)
    assert response == False

    response = is_prime(2)
    assert response == True