Skip to content

Commit 38dfcd2

Browse files
authored
fix: test failures (#6250)
1. Incorrect function was being imported from the module 2. Testing for exception was not done correctly
1 parent dcc3876 commit 38dfcd2

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

maths/miller_rabin.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
# if it's not a prime, the chance of it returning true is at most 1/4**prec
99
def is_prime_big(n, prec=1000):
1010
"""
11-
>>> from maths.prime_check import prime_check
12-
>>> # all(is_prime_big(i) == prime_check(i) for i in range(1000)) # 3.45s
13-
>>> all(is_prime_big(i) == prime_check(i) for i in range(256))
11+
>>> from maths.prime_check import is_prime
12+
>>> # all(is_prime_big(i) == is_prime(i) for i in range(1000)) # 3.45s
13+
>>> all(is_prime_big(i) == is_prime(i) for i in range(256))
1414
True
1515
"""
1616
if n < 2:

maths/prime_check.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ def test_primes(self):
6262
self.assertTrue(is_prime(29))
6363

6464
def test_not_primes(self):
65-
self.assertFalse(
66-
is_prime(-19),
67-
"Negative numbers are excluded by definition of prime numbers.",
68-
)
65+
with self.assertRaises(AssertionError):
66+
is_prime(-19)
6967
self.assertFalse(
7068
is_prime(0),
7169
"Zero doesn't have any positive factors, primes must have exactly two.",

0 commit comments

Comments
 (0)