From 50e32fd0e1b89c9472231d2309693659b605caa9 Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Wed, 18 Dec 2024 16:10:02 +0330 Subject: [PATCH] add test for wiktextract --- tests/g_wiktextract_test.py | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tests/g_wiktextract_test.py diff --git a/tests/g_wiktextract_test.py b/tests/g_wiktextract_test.py new file mode 100644 index 000000000..4134ace90 --- /dev/null +++ b/tests/g_wiktextract_test.py @@ -0,0 +1,42 @@ +import sys +import unittest +from os.path import abspath, dirname + +rootDir = dirname(dirname(abspath(__file__))) +sys.path.insert(0, rootDir) + +from glossary_v2_test import TestGlossaryBase + + +class TestGlossaryWiktextract(TestGlossaryBase): + def __init__(self, *args, **kwargs): + TestGlossaryBase.__init__(self, *args, **kwargs) + + self.dataFileCRC32.update( + { + "wiktextract/10-kaikki-fa-PlacesInIran.jsonl": "f7f4a92f", + "wiktextract/10-kaikki-fa-PlacesInIran.txt": "29b20845", + }, + ) + + def convert_jsonl_txt(self, fname, fname2, **convertArgs): + self.convert( + f"wiktextract/{fname}.jsonl", + f"{fname}-2.txt", + compareText=f"wiktextract/{fname2}.txt", + infoOverride={ + # without this, glos name would become f"wiktextract__{fname}.jsonl" + "name": f"{fname}.jsonl", + }, + **convertArgs, + ) + + def test_convert_jsonl_txt_1(self): + self.convert_jsonl_txt( + "10-kaikki-fa-PlacesInIran", + "10-kaikki-fa-PlacesInIran", + ) + + +if __name__ == "__main__": + unittest.main()