Skip to content

Commit

Permalink
Changelog, fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel committed Feb 27, 2019
1 parent 5c1458e commit 800463c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions changelog.d/892.misc.rst
@@ -0,0 +1,2 @@
Added test cases for parser.
Patch by @jbrockmendel (gh pr #892)
11 changes: 7 additions & 4 deletions dateutil/test/test_parser.py
Expand Up @@ -27,6 +27,13 @@
except ValueError:
PLATFORM_HAS_DASH_D = False


@pytest.fixture(params=[True, False])
def fuzzy(arg):
"""Fixture to pass fuzzy=True or fuzzy=False to parse"""
return arg.param


# Parser test cases using no keyword arguments. Format: (parsable_text, expected_datetime, assertion_message)
PARSER_TEST_CASES = [
("Thu Sep 25 10:36:28 2003", datetime(2003, 9, 25, 10, 36, 28), "date command format strip"),
Expand Down Expand Up @@ -681,25 +688,21 @@ def test_out_of_bound_day(self):
with pytest.raises(ValueError):
parse("Feb 30, 2007")

@pytest.mark.parametrize('fuzzy', [True, False])
def test_day_sanity(self, fuzzy):
dstr = "2014-15-25"
with pytest.raises(ValueError):
parse(dstr, fuzzy=fuzzy)

@pytest.mark.parametrize('fuzzy', [True, False])
def test_minute_sanity(self, fuzzy):
dstr = "2014-02-28 22:64"
with pytest.raises(ValueError):
parse(dstr, fuzzy=fuzzy)

@pytest.mark.parametrize('fuzzy', [True, False])
def test_hour_sanity(self, fuzzy):
dstr = "2014-02-28 25:16 PM"
with pytest.raises(ValueError):
parse(dstr, fuzzy=fuzzy)

@pytest.mark.parametrize('fuzzy', [True, False])
def test_second_sanity(self, fuzzy):
dstr = "2014-02-28 22:14:64"
with pytest.raises(ValueError):
Expand Down

0 comments on commit 800463c

Please sign in to comment.