コード例 #1
0
 def test__find_primes__when_one_arg__then_same_as_two_args_with_zero_as_min(
 ):
     # when
     result1 = find_primes(100)
     result2 = find_primes(0, 100)
     # then
     assert_that(list(result1)).is_equal_to(list(result2))
コード例 #2
0
 def test__find_primes__when_max_is_prime__then_primes_less_than_arg():
     # when
     result = find_primes(67)
     # then
     assert_that(list(result)).is_equal_to([
         2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61
     ])
コード例 #3
0
 def test__find_primes__when_one_arg__then_primes_less_than_arg():
     # when
     result = find_primes(100)
     # then
     assert_that(list(result)).is_equal_to([
         2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61,
         67, 71, 73, 79, 83, 89, 97
     ])
コード例 #4
0
 def test__find_primes__when_two_args__then_primes_between():
     # when
     result = find_primes(30, 200)
     # then
     assert_that(list(result)).is_equal_to([
         31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101,
         103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167,
         173, 179, 181, 191, 193, 197, 199
     ])
コード例 #5
0
 def test__find_primes__when_min_and_max_are_primes__then_primes_between_with_min_inclusive(
 ):
     # when
     result = find_primes(137, 317)
     # then
     assert_that(list(result)).is_equal_to([
         137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197,
         199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271,
         277, 281, 283, 293, 307, 311, 313
     ])
コード例 #6
0
 def test__find_primes__when_min_less_than_sqrt_of_max__then_primes_between(
 ):
     # when
     result = find_primes(5, 150)
     # then
     assert_that(list(result)).is_equal_to([
         5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67,
         71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137,
         139, 149
     ])
コード例 #7
0
 def test__find_primes__when_at_most_two():
     # when
     result = find_primes(2)
     # then
     assert_that(list(result)).is_empty()
コード例 #8
0
 def test__find_primes__when_two_args_descending__then_empty_generator():
     # when
     result = find_primes(100, 30)
     # then
     assert_that(list(result)).is_empty()
コード例 #9
0
 def function():
     find_primes(20, 200, 10)
コード例 #10
0
 def function():
     find_primes()
コード例 #11
0
 def test__find_primes__when_min_equals_max_and_composite__then_empty():
     # when
     result = find_primes(91, 91)
     # then
     assert_that(list(result)).is_empty()
コード例 #12
0
 def test__find_primes__when_min_equals_max_and_prime__then_empty_list():
     # when
     result = find_primes(41, 41)
     # then
     assert_that(list(result)).is_empty()