Skip to content

Revert "Commented doctests that were causing slowness at Travis." #1040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,31 @@ before_script:
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
script:
- mypy --ignore-missing-imports .
- pytest . --doctest-modules
--ignore=data_structures/stacks/balanced_parentheses.py
--ignore=data_structures/stacks/infix_to_postfix_conversion.py
--ignore=file_transfer_protocol/ftp_send_receive.py
--ignore=file_transfer_protocol/ftp_client_server.py
--ignore=machine_learning/linear_regression.py
--ignore=machine_learning/perceptron.py
--ignore=machine_learning/random_forest_classification/random_forest_classification.py
--ignore=machine_learning/random_forest_regression/random_forest_regression.py
--ignore=maths/abs_min.py
--ignore=maths/binary_exponentiation.py
--ignore=maths/lucas_series.py
--ignore=maths/sieve_of_eratosthenes.py
#- IGNORE="data_structures,file_transfer_protocol,graphs,machine_learning,maths,neural_network,project_euler"
#- pytest . --doctest-modules --ignore=${IGNORE}
- pytest --doctest-modules
arithmetic_analysis
backtracking
boolean_algebra
ciphers
compression
conversions
digital_image_processing
divide_and_conquer
dynamic_programming
graphs
hashes
linear_algebra_python
matrix
networking_flow
neural_network
other
project_euler
searches
sorts
strings
traversals

after_success:
- python scripts/build_directory_md.py
- cat DIRECTORY.md
5 changes: 2 additions & 3 deletions project_euler/problem_09/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ def solution():
2. a**2 + b**2 = c**2
3. a + b + c = 1000

# The code below has been commented due to slow execution affecting Travis.
# >>> solution()
# 31875000
>>> solution()
31875000
"""
for a in range(300):
for b in range(400):
Expand Down
4 changes: 2 additions & 2 deletions project_euler/problem_09/sol3.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def solution():
1. a**2 + b**2 = c**2
2. a + b + c = 1000

#>>> solution()
#31875000
>>> solution()
31875000
"""
return [
a * b * c
Expand Down
5 changes: 2 additions & 3 deletions project_euler/problem_10/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ def sum_of_primes(n):
def solution(n):
"""Returns the sum of all the primes below n.

# The code below has been commented due to slow execution affecting Travis.
# >>> solution(2000000)
# 142913828922
>>> solution(2000000)
142913828922
>>> solution(1000)
76127
>>> solution(5000)
Expand Down
5 changes: 2 additions & 3 deletions project_euler/problem_10/sol2.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ def prime_generator():
def solution(n):
"""Returns the sum of all the primes below n.

# The code below has been commented due to slow execution affecting Travis.
# >>> solution(2000000)
# 142913828922
>>> solution(2000000)
142913828922
>>> solution(1000)
76127
>>> solution(5000)
Expand Down
5 changes: 2 additions & 3 deletions project_euler/problem_12/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ def solution():
"""Returns the value of the first triangle number to have over five hundred
divisors.

# The code below has been commented due to slow execution affecting Travis.
# >>> solution()
# 76576500
>>> solution()
76576500
"""
tNum = 1
i = 1
Expand Down
5 changes: 2 additions & 3 deletions project_euler/problem_12/sol2.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ def solution():
"""Returns the value of the first triangle number to have over five hundred
divisors.

# The code below has been commented due to slow execution affecting Travis.
# >>> solution()
# 76576500
>>> solution()
76576500
"""
return next(
i for i in triangle_number_generator() if count_divisors(i) > 500
Expand Down
5 changes: 2 additions & 3 deletions project_euler/problem_14/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ def solution(n):
n → n/2 (n is even)
n → 3n + 1 (n is odd)

# The code below has been commented due to slow execution affecting Travis.
# >>> solution(1000000)
# {'counter': 525, 'largest_number': 837799}
>>> solution(1000000)
{'counter': 525, 'largest_number': 837799}
>>> solution(200)
{'counter': 125, 'largest_number': 171}
>>> solution(5000)
Expand Down
5 changes: 2 additions & 3 deletions project_euler/problem_14/sol2.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ def collatz_sequence(n):
def solution(n):
"""Returns the number under n that generates the longest Collatz sequence.

# The code below has been commented due to slow execution affecting Travis.
# >>> solution(1000000)
# {'counter': 525, 'largest_number': 837799}
>>> solution(1000000)
{'counter': 525, 'largest_number': 837799}
>>> solution(200)
{'counter': 125, 'largest_number': 171}
>>> solution(5000)
Expand Down