from aclc_ba.morphology.db_analyzer_based import DbAnalyzedBased


def test_db_solutoins_with_list() -> None:
    passed_tokenized_list = ["في", "استفتاء", "ضمني", "علي", "رئاسة", "بوش", ":"]
    expected_words_solutions_list = [
        [
            {
                "word": "في",
                "source_word": "",
                "lemmaid": "",
                "voc": "",
                "gloss": "",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "fiy",
                "suf1": "",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "في",
                "root": "",
                "stem_pattern": "",
                "tag": "ABBREV",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "في",
                "source_word": "",
                "lemmaid": "fiy",
                "voc": "",
                "gloss": "",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "fiy",
                "suf1": "",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "في",
                "root": "",
                "stem_pattern": "",
                "tag": "PREP",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
        ],
        [
            {
                "word": "استفتاء",
                "source_word": "",
                "lemmaid": "{isotifotA'",
                "voc": "",
                "gloss": "",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "{isotifotA'",
                "suf1": "",
                "suf2": "",
                "gen": "MASC",
                "num": "SG",
                "defen": "",
                "cas": "",
                "arabic_stem": "استفتاء",
                "root": "ftw/fty",
                "stem_pattern": "",
                "tag": "NOUN",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            }
        ],
        [
            {
                "word": "ضمني",
                "source_word": "",
                "lemmaid": "Dam~-u",
                "voc": "",
                "gloss": "",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "Dam~",
                "suf1": "a/PVSUFF_SUBJ:3MS",
                "suf2": "niy/PVSUFF_DO:1S",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "ضمّ",
                "root": "Dmm",
                "stem_pattern": "",
                "tag": "PV",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "ضمني",
                "source_word": "",
                "lemmaid": "Dimoniy~",
                "voc": "",
                "gloss": "",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "Dimoniy~",
                "suf1": "",
                "suf2": "",
                "gen": "MASC",
                "num": "SG",
                "defen": "",
                "cas": "",
                "arabic_stem": "ضمنيّ",
                "root": "Dmn",
                "stem_pattern": "",
                "tag": "ADJ",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
        ],
        [
            {
                "word": "علي",
                "source_word": "",
                "lemmaid": "Eal~aY",
                "voc": "",
                "gloss": "",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "Eal~",
                "suf1": "iy/CVSUFF_SUBJ:2FS",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "علّ",
                "root": "Elw/Ely",
                "stem_pattern": "",
                "tag": "CV",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "علي",
                "source_word": "",
                "lemmaid": "EalaY",
                "voc": "",
                "gloss": "",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "Ealay",
                "suf1": "~a/PRON_1S",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "علي",
                "root": "",
                "stem_pattern": "",
                "tag": "PREP",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "علي",
                "source_word": "",
                "lemmaid": "Ealiy~",
                "voc": "",
                "gloss": "",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "Ealiy~",
                "suf1": "",
                "suf2": "",
                "gen": "MASC",
                "num": "SG",
                "defen": "",
                "cas": "",
                "arabic_stem": "عليّ",
                "root": "Elw/Ely",
                "stem_pattern": "",
                "tag": "NOUN_PROP",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
        ],
        [
            {
                "word": "رئاسة",
                "source_word": "",
                "lemmaid": "ri}Asap",
                "voc": "",
                "gloss": "",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "ri}As",
                "suf1": "ap/NSUFF",
                "suf2": "",
                "gen": "FEM",
                "num": "SG",
                "defen": "",
                "cas": "",
                "arabic_stem": "رئاس",
                "root": "r's",
                "stem_pattern": "",
                "tag": "NOUN",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            }
        ],
        [
            {
                "word": "بوش",
                "source_word": "",
                "lemmaid": "buw$",
                "voc": "",
                "gloss": "",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "buw$",
                "suf1": "",
                "suf2": "",
                "gen": "MASC",
                "num": "SG",
                "defen": "",
                "cas": "",
                "arabic_stem": "بوش",
                "root": "",
                "stem_pattern": "",
                "tag": "NOUN_PROP",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            }
        ],
        [],
    ]
    db = DbAnalyzedBased()
    result_words_analysis = db.analyze_words(passed_tokenized_list)
    assert result_words_analysis == expected_words_solutions_list


def test_db_solutoins_with_list() -> None:
    passed_word = "الديمقراطيين"
    expected_analysis = [
        {
            "word": "الديمقراطيين",
            "source_word": "",
            "lemmaid": "diymuqrATiy~",
            "voc": "",
            "gloss": "",
            "pr1": "Al/DET",
            "pr2": "",
            "pr3": "",
            "stem": "diymuqrATiy~",
            "suf1": "iyna/NSUFF",
            "suf2": "",
            "gen": "MASC",
            "num": "PL",
            "defen": "",
            "cas": "",
            "arabic_stem": "ديمقراطيّ",
            "root": "",
            "stem_pattern": "",
            "tag": "ADJ",
            "name_entities": "",
            "indexx": "",
            "affectedBy": "",
            "afterRuleSols": "",
            "Surrounds": "",
        },
        {
            "word": "الديمقراطيين",
            "source_word": "",
            "lemmaid": "diymuqrATiy~",
            "voc": "",
            "gloss": "",
            "pr1": "Al/DET",
            "pr2": "",
            "pr3": "",
            "stem": "diymuqrATiy~",
            "suf1": "iyna/NSUFF",
            "suf2": "",
            "gen": "MASC",
            "num": "PL",
            "defen": "",
            "cas": "",
            "arabic_stem": "ديمقراطيّ",
            "root": "",
            "stem_pattern": "",
            "tag": "NOUN",
            "name_entities": "",
            "indexx": "",
            "affectedBy": "",
            "afterRuleSols": "",
            "Surrounds": "",
        },
    ]
    db = DbAnalyzedBased()
    result_word_analysis = db.analyze(passed_word)
    assert result_word_analysis == expected_analysis
