glossary test: added testcase for to_str() without description
This commit is contained in:
@@ -197,3 +197,13 @@ class TestGlossary(unittest.TestCase):
|
|||||||
self.assertIn("- An empty test glossary", glossary_str_no_id_no_entries)
|
self.assertIn("- An empty test glossary", glossary_str_no_id_no_entries)
|
||||||
self.assertIn("- Languages: en -> fr", glossary_str_no_id_no_entries)
|
self.assertIn("- Languages: en -> fr", glossary_str_no_id_no_entries)
|
||||||
self.assertIn("- Entries: 0", glossary_str_no_id_no_entries)
|
self.assertIn("- Entries: 0", glossary_str_no_id_no_entries)
|
||||||
|
|
||||||
|
def test_to_str_no_description(self) -> None:
|
||||||
|
# Create a Glossary instance with an ID
|
||||||
|
glossary_with_id = Glossary(name="TestGlossary", source_lang="en", target_lang="fr",
|
||||||
|
ID="1001", entries={"one": "un"})
|
||||||
|
glossary_str = glossary_with_id.to_str()
|
||||||
|
expected_str = """TestGlossary (ID: 1001):
|
||||||
|
- Languages: en -> fr
|
||||||
|
- Entries: 1"""
|
||||||
|
self.assertEqual(expected_str, glossary_str)
|
||||||
|
|||||||
Reference in New Issue
Block a user