Skip to content

Commit

Permalink
Add explicit tests for format_skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Birtwell committed Sep 29, 2015
1 parent 8f301f1 commit 5519960
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/test_core.py
Expand Up @@ -224,6 +224,10 @@ def test_datetime_formats_property(self):
assert Locale('en').datetime_formats['full'] == u"{1} 'at' {0}"
assert Locale('th').datetime_formats['medium'] == u'{1} {0}'

def test_datetime_skeleton_property(self):
assert Locale('en').datetime_skeletons['Md'].pattern == u"M/d"
assert Locale('th').datetime_skeletons['Md'].pattern == u'd/M'

def test_plural_form_property(self):
assert Locale('en').plural_form(1) == 'one'
assert Locale('en').plural_form(0) == 'other'
Expand Down
9 changes: 9 additions & 0 deletions tests/test_dates.py
Expand Up @@ -498,6 +498,15 @@ def test_format_time():
assert us_east == u'3:30:00 PM Eastern Standard Time'


def test_format_skeleton():
dt = datetime(2007, 4, 1, 15, 30)
assert (dates.format_skeleton('yMEd', dt, locale='en_US') == u'Sun, 4/1/2007')
assert (dates.format_skeleton('yMEd', dt, locale='th') == u'\u0e2d\u0e32. 1/4/2007')

assert (dates.format_skeleton('EHm', dt, locale='en') == u'Sun 15:30')
assert (dates.format_skeleton('EHm', dt, tzinfo=timezone('Asia/Bangkok'), locale='th') == u'\u0e2d\u0e32. 22:30')


def test_format_timedelta():
assert (dates.format_timedelta(timedelta(weeks=12), locale='en_US')
== u'3 months')
Expand Down

0 comments on commit 5519960

Please sign in to comment.