Exemple #1
0
def test_extract_date_yyyy_mm_dd_missing_separator():
    with pytest.raises(ValueError):
        assert TimesheetParser.extract_date('2012/0801')
Exemple #2
0
def test_extract_date_incomplete_date():
    with pytest.raises(ValueError):
        assert TimesheetParser.extract_date('05/08')
Exemple #3
0
def test_extract_date_missing_all_separators():
    with pytest.raises(ValueError):
        assert TimesheetParser.extract_date('05082012')
Exemple #4
0
def test_extract_date_invalid_string():
    with pytest.raises(ValueError):
        assert TimesheetParser.extract_date('foobar')
Exemple #5
0
def test_extract_date_yyyy_mm_dd():
    assert TimesheetParser.extract_date('2013/08/09') == datetime.date(2013, 8, 9)
Exemple #6
0
def test_extract_date_short_year():
    assert TimesheetParser.extract_date('05/08/12') == datetime.date(2012, 8, 5)
Exemple #7
0
def test_extract_date_slash_separator():
    assert TimesheetParser.extract_date('05/08/2012') == datetime.date(2012, 8, 5)
Exemple #8
0
def test_extract_date_dot_separator():
    assert TimesheetParser.extract_date('1.1.2010') == datetime.date(2010, 1, 1)