Skip to content

Commit

Permalink
better test organisation
Browse files Browse the repository at this point in the history
  • Loading branch information
catsmith committed Apr 19, 2024
1 parent 96c6243 commit 6825c14
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
Empty file added unit_tests/__init__.py
Empty file.
29 changes: 25 additions & 4 deletions tests_exporter.py → unit_tests/test_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,14 +584,28 @@ class ExporterUnitTests(TestCase):

def test_get_text_default_settings(self):
exp = Exporter()
reading = self.BASE_UNIT['readings'][0]
reading = {'_id': 'abc',
'text': [{'interface': 'υιον'},
{'interface': 'αυτου'}],
'label': 'a',
'text_string': 'υιον αυτου',
'subreadings': {
'abbreviation': [{'text_string': 'υν αυτου',
'text': []}]}}
expected_text = ['υιον αυτου']
generated_text = exp.get_text(reading)
self.assertEqual(expected_text, generated_text)

def test_get_text_default_settings_older_format(self):
exp = Exporter()
reading = self.BASE_UNIT['readings'][0]
reading = {'_id': 'abc',
'text': [{'interface': 'υιον'},
{'interface': 'αυτου'}],
'label': 'a',
'text_string': 'υιον αυτου',
'subreadings': {
'abbreviation': [{'text_string': 'υν αυτου',
'text': []}]}}
# change the data to the older format
del reading['text_string']
expected_text = ['υιον αυτου']
Expand All @@ -600,9 +614,16 @@ def test_get_text_default_settings_older_format(self):

def test_get_text_default_settings_subreading(self):
exp = Exporter()
reading = self.BASE_UNIT['readings'][0]['subreadings']['abbreviation'][0]
reading = {'_id': 'abc',
'text': [{'interface': 'υιον'},
{'interface': 'αυτου'}],
'label': 'a',
'text_string': 'υιον αυτου',
'subreadings': {
'abbreviation': [{'text_string': 'υν αυτου',
'text': []}]}}
expected_text = ['υν αυτου']
generated_text = exp.get_text(reading, is_subreading=True)
generated_text = exp.get_text(reading['subreadings']['abbreviation'][0], is_subreading=True)
self.assertEqual(expected_text, generated_text)

def test_get_text_default_settings_om(self):
Expand Down

0 comments on commit 6825c14

Please sign in to comment.