refactor: move import pytest line of blockchain algs under "main" section. (#2012)

* change doctest line

import doctest is not relevant with algorithms. move it under main section.

* from doctest import testmod

* refactor: move doctest under "main" section

* Update diophantine_equation.py

* Update modular_division.py

Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
Jie Han 2020-05-19 18:56:16 +08:00 committed by GitHub
parent 1c62bd10c1
commit c906ba82f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -118,10 +118,9 @@ def extended_gcd(a, b):
return (d, x, y) return (d, x, y)
# import testmod for testing our function if __name__ == "__main__":
from doctest import testmod from doctest import testmod
if __name__ == "__main__":
testmod(name="diophantine", verbose=True) testmod(name="diophantine", verbose=True)
testmod(name="diophantine_all_soln", verbose=True) testmod(name="diophantine_all_soln", verbose=True)
testmod(name="extended_gcd", verbose=True) testmod(name="extended_gcd", verbose=True)

View File

@ -139,10 +139,9 @@ def greatest_common_divisor(a, b):
return b return b
# Import testmod for testing our function if __name__ == "__main__":
from doctest import testmod from doctest import testmod
if __name__ == "__main__":
testmod(name="modular_division", verbose=True) testmod(name="modular_division", verbose=True)
testmod(name="modular_division2", verbose=True) testmod(name="modular_division2", verbose=True)
testmod(name="invert_modulo", verbose=True) testmod(name="invert_modulo", verbose=True)