Skip to content

Commit 1ec7b3f

Browse files
committed
dontprint
1 parent bc17c41 commit 1ec7b3f

File tree

2 files changed

+25
-26
lines changed

2 files changed

+25
-26
lines changed

tests/_basics.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -83,31 +83,31 @@ def report(output):
8383
def doctest_ok(test):
8484
"""doctests zijn voldoende aanwezig en geven allemaal akkoord"""
8585
def testMethod():
86-
with open(test.fileName, 'r') as source_file:
87-
source = source_file.read()
88-
functions = re.findall(r'def\s+(\w+)\(([^\)]*)\)[^-]+(->\s*([\w\[,\] _]+))?:', source)
89-
n_functions_not_returning = len([function for function in functions if ('file' in function[1] or function[3] == 'None' or function[3] == '')])
90-
n_functions = len(functions)
91-
p = subprocess.run([sys.executable or 'python3', '-m', 'doctest', '-v', test.fileName], capture_output=True, universal_newlines=True)
92-
if "Traceback" in p.stderr:
93-
return False, p.stderr.splitlines()[-1]
94-
test_stats_rex = re.compile('(\d*) tests in (\d*) items')
95-
test_pass_rex = re.compile('(\d*) passed and (\d*) failed')
96-
test_stats = test_stats_rex.search(p.stdout.splitlines()[-3])
97-
test_pass = test_pass_rex.search(p.stdout.splitlines()[-2])
98-
n_tests = int(test_stats.group(1))
99-
n_items = int(test_stats.group(2))-1
100-
n_tested = n_items-n_functions_not_returning
101-
n_pass = int(test_pass.group(1))
102-
if n_functions == 0:
103-
return False, "je programma moet functies gebruiken (of type hints ontbreken!)"
104-
elif n_tested == 0:
105-
# geen testbare functies blijkbaar?
106-
return True
107-
elif n_tested > 0 and n_tests // n_tested < 2:
108-
return False, f"{n_tests} voorbeelden bij {n_tested} testbare functies is niet genoeg \n (we tellen alleen functies die iets returnen)"
109-
elif n_pass < n_tests:
110-
return False, f"{n_pass} van {n_tests} voorbeelden slagen"
86+
# with open(test.fileName, 'r') as source_file:
87+
# source = source_file.read()
88+
# functions = re.findall(r'def\s+(\w+)\(([^\)]*)\)[^-]+(->\s*([\w\[,\] _]+))?:', source)
89+
# n_functions_not_returning = len([function for function in functions if ('file' in function[1] or function[3] == 'None' or function[3] == '')])
90+
# n_functions = len(functions)
91+
# p = subprocess.run([sys.executable or 'python3', '-m', 'doctest', '-v', test.fileName], capture_output=True, universal_newlines=True)
92+
# if "Traceback" in p.stderr:
93+
# return False, p.stderr.splitlines()[-1]
94+
# test_stats_rex = re.compile('(\d*) tests in (\d*) items')
95+
# test_pass_rex = re.compile('(\d*) passed and (\d*) failed')
96+
# test_stats = test_stats_rex.search(p.stdout.splitlines()[-3])
97+
# test_pass = test_pass_rex.search(p.stdout.splitlines()[-2])
98+
# n_tests = int(test_stats.group(1))
99+
# n_items = int(test_stats.group(2))-1
100+
# n_tested = n_items-n_functions_not_returning
101+
# n_pass = int(test_pass.group(1))
102+
# if n_functions == 0:
103+
# return False, "je programma moet functies gebruiken (of type hints ontbreken!)"
104+
# elif n_tested == 0:
105+
# # geen testbare functies blijkbaar?
106+
# return True
107+
# elif n_tested > 0 and n_tests // n_tested < 2:
108+
# return False, f"{n_tests} voorbeelden bij {n_tested} testbare functies is niet genoeg \n (we tellen alleen functies die iets returnen)"
109+
# elif n_pass < n_tests:
110+
# return False, f"{n_pass} van {n_tests} voorbeelden slagen"
111111
return True
112112

113113
test.test = testMethod

tests/virusTest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ def testMethod():
254254
viruses = ["GGGG", "AAAA", "TTTT", "GGGG", "ATGC"] * 20
255255

256256
x = simulate(viruses, 0, 0, 0, 100, 500)
257-
print(x)
258257

259258
for pop_size in simulate(viruses, 0, 0, 0, 100, 500):
260259
if pop_size != 100:

0 commit comments

Comments
 (0)