Skip to content

Commit

Permalink
Tests for insensitive matching
Browse files Browse the repository at this point in the history
  • Loading branch information
cshowe committed Feb 26, 2015
1 parent dd4ccc6 commit b548972
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions tests/parser_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,3 +398,53 @@ def test_parse_fails(self):

with assertRaises(parser.ParserError):
self.parser.parse('fail')


class DateTimeParserMonthNameTests(Chai):

def setUp(self):
super(DateTimeParserMonthNameTests, self).setUp()

self.parser = parser.DateTimeParser('en_us')

def test_shortmonth_capitalized(self):

assertEqual(
self.parser.parse('2013-Jan-01', 'YYYY-MMM-DD'),
datetime(2013, 1, 1)
)

def test_shortmonth_allupper(self):

assertEqual(
self.parser.parse('2013-JAN-01', 'YYYY-MMM-DD'),
datetime(2013, 1, 1)
)

def test_shortmonth_alllower(self):

assertEqual(
self.parser.parse('2013-jan-01', 'YYYY-MMM-DD'),
datetime(2013, 1, 1)
)

def test_month_capitalized(self):

assertEqual(
self.parser.parse('2013-January-01', 'YYYY-MMMM-DD'),
datetime(2013, 1, 1)
)

def test_month_allupper(self):

assertEqual(
self.parser.parse('2013-JANUARY-01', 'YYYY-MMMM-DD'),
datetime(2013, 1, 1)
)

def test_month_alllower(self):

assertEqual(
self.parser.parse('2013-january-01', 'YYYY-MMMM-DD'),
datetime(2013, 1, 1)
)

0 comments on commit b548972

Please sign in to comment.