Skip to content

Commit

Permalink
Tests for empty plurals
Browse files Browse the repository at this point in the history
  • Loading branch information
kbairak committed Apr 22, 2016
1 parent 74d0ebb commit 9ec5295
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions openformats/tests/formats/android/test_android.py
Expand Up @@ -152,21 +152,38 @@ def test_empty_string_array_item_ignored(self):
self.assertEquals(stringset, [])
self.assertEquals(template, source)

def test_empty_plural_ignored(self):
random_key = generate_random_string()
source = strip_leading_spaces(u'''
def test_empty_plural_raises_error(self):
self._test_parse_error(
'<resources><plurals name="a"></plurals></resources>',
u"Empty <plurals> tag on line 1"
)

def test_empty_plural_item_raises_error(self):
self._test_parse_error(
'''
<resources>
<plurals name="a">
<item quantity="one"></item>
<item quantity="other">hello</item>
</plurals>
</resources>
''',
u"Not all <item> tags are filled in lines 3-6"
)

def test_all_plural_items_empty_get_skipped(self):
source = u'''
<resources>
<plurals name="{key}">
<plurals name="a">
<item quantity="one"></item>
<item quantity="other"></item>
</plurals>
</resources>
'''.format(key=random_key))

'''
template, stringset = self.handler.parse(source)

self.assertEquals(stringset, [])
self.assertEquals(template, source)
self.assertEquals(stringset, [])

def test_missing_translated_strings_removed(self):
random_key = generate_random_string()
Expand Down

0 comments on commit 9ec5295

Please sign in to comment.