Skip to content

Instantly share code, notes, and snippets.

@alunduil
Created October 29, 2020 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alunduil/48451ed4d2928a1083562b339934b541 to your computer and use it in GitHub Desktop.
Save alunduil/48451ed4d2928a1083562b339934b541 to your computer and use it in GitHub Desktop.
stdin
============================= test session starts ==============================
platform linux -- Python 3.7.6, pytest-6.1.1, py-1.9.0, pluggy-0.13.1
rootdir: /home/alunduil/Projects/python/cron-interval, configfile: pyproject.toml, testpaths: cron_test
plugins: cov-2.10.1, hypothesis-5.37.4
collected 5 items
cron_test/expression_test.py FF [ 40%]
cron_test/field_test.py FF. [100%]
=================================== FAILURES ===================================
_______________________ test_generate_valid_expressions ________________________
@given(expression=expressions()) # type: ignore
> def test_generate_valid_expressions(expression: Expression) -> None:
cron_test/expression_test.py:10:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cron/field.py:34: in from_string
).parse(field),
/nix/store/w9mraw5rxhvjgsih0671q787g3qsvg07-python3.7-parsy-1.3.0/lib/python3.7/site-packages/parsy/__init__.py:90: in parse
(result, _) = (self << eof).parse_partial(stream)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <parsy.Parser object at 0x7caa9d6b0c50>, stream = '3,4,6'
def parse_partial(self, stream):
"""
Parse the longest possible prefix of a given string.
Return a tuple of the result and the rest of the string,
or raise a ParseError.
"""
result = self(stream, 0)
if result.status:
return (result.value, stream[result.index:])
else:
> raise ParseError(result.expected, stream, result.furthest)
E parsy.ParseError: expected one of '-', 'EOF', 'a digit' at 0:1
/nix/store/w9mraw5rxhvjgsih0671q787g3qsvg07-python3.7-parsy-1.3.0/lib/python3.7/site-packages/parsy/__init__.py:104: ParseError
---------------------------------- Hypothesis ----------------------------------
You can add @seed(236709794982223855423838308424265755500) to this test or run pytest with --hypothesis-seed=236709794982223855423838308424265755500 to reproduce this failure.
_____________________ test_generate_parseable_expressions ______________________
@given(expression=expressions()) # type: ignore
> def test_generate_parseable_expressions(expression: Expression) -> None:
E hypothesis.errors.MultipleFailures: Hypothesis found 2 distinct failures.
cron_test/expression_test.py:16: MultipleFailures
---------------------------------- Hypothesis ----------------------------------
Falsifying example: test_generate_parseable_expressions(
expression=Expression(minutes=Field(original='*', _range=None), hours=Field(original='*', _range=None), day_of_month=Field(original='*', _range=None), month=Field(original='*', _range=None), day_of_week=Field(original='*', _range=None), year=Field(original='*', _range=None)),
)
Traceback (most recent call last):
File "/home/alunduil/Projects/python/cron-interval/cron_test/expression_test.py", line 18, in test_generate_parseable_expressions
assert Expression.from_string(str(expression))
File "/home/alunduil/Projects/python/cron-interval/cron/expression.py", line 27, in from_string
fields = [Field.from_string(f) for f in expression.split(" ")]
File "/home/alunduil/Projects/python/cron-interval/cron/expression.py", line 27, in <listcomp>
fields = [Field.from_string(f) for f in expression.split(" ")]
File "/home/alunduil/Projects/python/cron-interval/cron/field.py", line 34, in from_string
).parse(field),
File "/nix/store/w9mraw5rxhvjgsih0671q787g3qsvg07-python3.7-parsy-1.3.0/lib/python3.7/site-packages/parsy/__init__.py", line 90, in parse
(result, _) = (self << eof).parse_partial(stream)
File "/nix/store/w9mraw5rxhvjgsih0671q787g3qsvg07-python3.7-parsy-1.3.0/lib/python3.7/site-packages/parsy/__init__.py", line 104, in parse_partial
raise ParseError(result.expected, stream, result.furthest)
parsy.ParseError: expected 'EOF' at 0:1
Falsifying example: test_generate_parseable_expressions(
expression=Expression(minutes=Field(original='*', _range=None), hours=Field(original='*', _range=None), day_of_month=Field(original='*', _range=None), month=Field(original='*', _range=None), day_of_week=Field(original='*', _range=None), year=None),
)
Traceback (most recent call last):
File "/home/alunduil/Projects/python/cron-interval/cron_test/expression_test.py", line 18, in test_generate_parseable_expressions
assert Expression.from_string(str(expression))
File "/home/alunduil/Projects/python/cron-interval/cron/expression.py", line 27, in from_string
fields = [Field.from_string(f) for f in expression.split(" ")]
File "/home/alunduil/Projects/python/cron-interval/cron/expression.py", line 27, in <listcomp>
fields = [Field.from_string(f) for f in expression.split(" ")]
File "/home/alunduil/Projects/python/cron-interval/cron/field.py", line 28, in from_string
raise ValueError(f"invalid literal for Field.from_string(): '{field}'")
ValueError: invalid literal for Field.from_string(): ''
__________________________ test_generate_valid_field ___________________________
@given(field=fields(min_value=0, max_value=59)) # type: ignore
> def test_generate_valid_field(field: Field) -> None:
cron_test/field_test.py:10:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cron/field.py:34: in from_string
).parse(field),
/nix/store/w9mraw5rxhvjgsih0671q787g3qsvg07-python3.7-parsy-1.3.0/lib/python3.7/site-packages/parsy/__init__.py:90: in parse
(result, _) = (self << eof).parse_partial(stream)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <parsy.Parser object at 0x7caa9d6507d0>, stream = '20'
def parse_partial(self, stream):
"""
Parse the longest possible prefix of a given string.
Return a tuple of the result and the rest of the string,
or raise a ParseError.
"""
result = self(stream, 0)
if result.status:
return (result.value, stream[result.index:])
else:
> raise ParseError(result.expected, stream, result.furthest)
E parsy.ParseError: expected one of '-', 'a digit' at 0:2
/nix/store/w9mraw5rxhvjgsih0671q787g3qsvg07-python3.7-parsy-1.3.0/lib/python3.7/site-packages/parsy/__init__.py:104: ParseError
---------------------------------- Hypothesis ----------------------------------
You can add @seed(213027046006424565259256459642424212053) to this test or run pytest with --hypothesis-seed=213027046006424565259256459642424212053 to reproduce this failure.
___________________________ test_minimize_idempotent ___________________________
@given(field=fields(min_value=0, max_value=59)) # type: ignore
> def test_minimize_idempotent(field: Field) -> None:
cron_test/field_test.py:16:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cron/field.py:34: in from_string
).parse(field),
/nix/store/w9mraw5rxhvjgsih0671q787g3qsvg07-python3.7-parsy-1.3.0/lib/python3.7/site-packages/parsy/__init__.py:90: in parse
(result, _) = (self << eof).parse_partial(stream)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <parsy.Parser object at 0x7caa9d677d50>, stream = '8,1'
def parse_partial(self, stream):
"""
Parse the longest possible prefix of a given string.
Return a tuple of the result and the rest of the string,
or raise a ParseError.
"""
result = self(stream, 0)
if result.status:
return (result.value, stream[result.index:])
else:
> raise ParseError(result.expected, stream, result.furthest)
E parsy.ParseError: expected one of '-', 'EOF', 'a digit' at 0:1
/nix/store/w9mraw5rxhvjgsih0671q787g3qsvg07-python3.7-parsy-1.3.0/lib/python3.7/site-packages/parsy/__init__.py:104: ParseError
---------------------------------- Hypothesis ----------------------------------
You can add @seed(230556603056894015096547527987425503728) to this test or run pytest with --hypothesis-seed=230556603056894015096547527987425503728 to reproduce this failure.
----------- coverage: platform linux, python 3.7.6-final-0 -----------
Name Stmts Miss Cover Missing
--------------------------------------------------
cron/__init__.py 1 0 100%
cron/error.py 6 2 67% 12-13
cron/expression.py 29 7 76% 29-36, 52, 54
cron/field.py 31 6 81% 52, 57-61
--------------------------------------------------
TOTAL 67 15 78%
=========================== short test summary info ============================
FAILED cron_test/expression_test.py::test_generate_valid_expressions - parsy....
FAILED cron_test/expression_test.py::test_generate_parseable_expressions - hy...
FAILED cron_test/field_test.py::test_generate_valid_field - parsy.ParseError:...
FAILED cron_test/field_test.py::test_minimize_idempotent - parsy.ParseError: ...
========================= 4 failed, 1 passed in 0.36s ==========================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment