accomodate for pypy
This commit is contained in:
parent
904caf85ae
commit
78e180871e
2
setup.py
2
setup.py
@ -3,7 +3,7 @@ from setuptools import setup
|
||||
setup(
|
||||
name='py-tools',
|
||||
version='0.2',
|
||||
packages=[''],
|
||||
packages=['tools'],
|
||||
url='',
|
||||
license='GPLv3',
|
||||
author='Stefan Harmuth',
|
||||
|
||||
16
tools/aoc.py
16
tools/aoc.py
@ -116,7 +116,7 @@ def printSolution(day: int, part: int, solution: Any, test: bool = None, test_ca
|
||||
if exec_time is None:
|
||||
time_output = ""
|
||||
else:
|
||||
units = ['s', 'ms', 'μs', 'ns']
|
||||
units = ['s', 'ms', 'µs', 'ns']
|
||||
unit = 0
|
||||
while exec_time < 1:
|
||||
exec_time *= 1000
|
||||
@ -126,11 +126,19 @@ def printSolution(day: int, part: int, solution: Any, test: bool = None, test_ca
|
||||
|
||||
if test is not None:
|
||||
print(
|
||||
"%s (TEST day%d/part%d/case%d) -- got '%s' -- expected '%s'"
|
||||
% ("OK" if test == solution else "FAIL", day, part, test_case, solution, test)
|
||||
"%s (TEST day%d/part%d/case%d) -- got '%s' -- expected '%s'%s"
|
||||
% ("OK" if test == solution else "FAIL", day, part, test_case, solution, test, time_output)
|
||||
)
|
||||
else:
|
||||
print("Solution to day %s, part %s: %s%s" % (day, part, solution, time_output))
|
||||
print(
|
||||
"Solution to day %s, part %s: %s%s"
|
||||
% (
|
||||
day,
|
||||
part,
|
||||
solution,
|
||||
time_output
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def splitLine(line, split_char: str = ',', return_type: Union[Type, List[Type]] = None):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user