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