from aclc_ba.morphology.bw_solutions import BwSolution


def test_bw_solutoins_with_list() -> None:
    passed_tokenized_list = ["في", "استفتاء", "ضمني", "علي", "رئاسة", "بوش", ":"]
    expected_words_solutions_list = [
        [
            {
                "word": "في",
                "source_word": "",
                "lemmaid": "fiy",
                "voc": "fiy",
                "gloss": "in",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "fiy",
                "suf1": "",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "",
                "stem_pattern": "faEal",
                "tag": "PREP",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "في",
                "source_word": "",
                "lemmaid": "fiy",
                "voc": "fiy~a",
                "gloss": "in + me",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "fiy",
                "suf1": "~a/POSS_PRON_1S",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "",
                "stem_pattern": "faEal",
                "tag": "PREP",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "في",
                "source_word": "",
                "lemmaid": "fiy",
                "voc": "fiy",
                "gloss": "V.",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "Viy",
                "suf1": "",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "",
                "stem_pattern": "faEal",
                "tag": "ABBREV",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "في",
                "source_word": "",
                "lemmaid": "y",
                "voc": "fay",
                "gloss": "and/so + Y./10th",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "y",
                "suf1": "",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "brq",
                "stem_pattern": "mufoEil",
                "tag": "ABBREV",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
        ],
        [
            {
                "word": "استفتاء",
                "source_word": "",
                "lemmaid": "{isotifotA'",
                "voc": "AisotifotA'",
                "gloss": "referendums/polls/questionnaires",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "{isotifotA'",
                "suf1": "",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "ftw/fty",
                "stem_pattern": "{isotifoEaAl",
                "tag": "NOUN",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "استفتاء",
                "source_word": "",
                "lemmaid": "{isotifotA'",
                "voc": "AisotifotA'F",
                "gloss": "referendums/polls/questionnaires",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "{isotifotA'",
                "suf1": "F/NOUN",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "ftw/fty",
                "stem_pattern": "{isotifoEaAl",
                "tag": "NOUN",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "استفتاء",
                "source_word": "",
                "lemmaid": "{isotifotA'",
                "voc": "AisotifotA'F",
                "gloss": "referendum/poll/questionnaire",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "{isotifotA'",
                "suf1": "F/NOUN",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "ftw/fty",
                "stem_pattern": "{isotifoEaAl",
                "tag": "NOUN",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
        ],
        [
            {
                "word": "ضمني",
                "source_word": "",
                "lemmaid": "Dimoniy~",
                "voc": "Dimoniy~",
                "gloss": "implicit/tacit",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "Dimoniy~",
                "suf1": "",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "Dmn",
                "stem_pattern": "fiEoliy~",
                "tag": "ADJ",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "ضمني",
                "source_word": "",
                "lemmaid": "Dimon",
                "voc": "Dimoniy",
                "gloss": "within/inside/among + my",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "Dimon",
                "suf1": "iy/POSS_PRON_1S",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "Dmn",
                "stem_pattern": "fiEol",
                "tag": "NOUN_ADV(P)",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "ضمني",
                "source_word": "",
                "lemmaid": "Dimon",
                "voc": "Dimoniiy",
                "gloss": "within/inside/among + my",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "Dimon",
                "suf1": "iy/POSS_PRON_1S",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "Dmn",
                "stem_pattern": "fiEol",
                "tag": "NOUN",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "ضمني",
                "source_word": "",
                "lemmaid": "Dam~-u",
                "voc": "Dam~aniy",
                "gloss": "include/comprise/incorporate + he/it + me",
                "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": "faEal",
                "tag": "PV",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
        ],
        [
            {
                "word": "علي",
                "source_word": "",
                "lemmaid": "EalaY",
                "voc": "Ealay~a",
                "gloss": "on/above + me",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "Ealay",
                "suf1": "~a/POSS_PRON_1S",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "",
                "stem_pattern": "faEal",
                "tag": "PREP",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "علي",
                "source_word": "",
                "lemmaid": "Ealiy~",
                "voc": "Ealiy~",
                "gloss": "supreme/high",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "Ealiy~",
                "suf1": "",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "Ely",
                "stem_pattern": "faEiyl",
                "tag": "ADJ",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "علي",
                "source_word": "",
                "lemmaid": "Ealiy~",
                "voc": "Ealiy~",
                "gloss": "Ali",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "Ealiy~",
                "suf1": "",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "Ely",
                "stem_pattern": "faEiyl",
                "tag": "NOUN_PROP",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "علي",
                "source_word": "",
                "lemmaid": "Eal~a",
                "voc": "Eal~aiy",
                "gloss": "perhaps/maybe + I",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "Eal~a",
                "suf1": "iy/POSS_PRON_1S",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "",
                "stem_pattern": "faEal",
                "tag": "SUB_CONJ",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "علي",
                "source_word": "",
                "lemmaid": "Eal~aY",
                "voc": "Eal~iy",
                "gloss": "elevate/raise + you",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "Eal~",
                "suf1": "iy/CVSUFF_SUBJ:2FS",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "Elw/Ely",
                "stem_pattern": "faE~",
                "tag": "CV",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "علي",
                "source_word": "",
                "lemmaid": "EalaY",
                "voc": "EalaY",
                "gloss": "on/above",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "EalaY",
                "suf1": "",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "",
                "stem_pattern": "faEal",
                "tag": "PREP",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
        ],
        [
            {
                "word": "رئاسة",
                "source_word": "",
                "lemmaid": "ri}Asap",
                "voc": "ri}Asap",
                "gloss": "presidency/leadership/chairmanship",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "ri}As",
                "suf1": "ap/NSUFF",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "r's",
                "stem_pattern": "fiEaAl",
                "tag": "NOUN",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "رئاسة",
                "source_word": "",
                "lemmaid": "ri}Asap",
                "voc": "ri}Asap",
                "gloss": "presidency/leadership/chairmanship",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "ri}As",
                "suf1": "ap/NSUFF",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "r's",
                "stem_pattern": "fiEaAl",
                "tag": "NOUN",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
        ],
        [
            {
                "word": "بوش",
                "source_word": "",
                "lemmaid": "buw$",
                "voc": "buw$",
                "gloss": "Bush",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "buw$",
                "suf1": "",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "",
                "stem_pattern": "faEal",
                "tag": "NOUN_PROP",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "بوش",
                "source_word": "",
                "lemmaid": "baw~a$",
                "voc": "baw~a$a",
                "gloss": "be boisterous + he/it",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "baw~a$",
                "suf1": "a/PVSUFF_SUBJ:3MS",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "bw$",
                "stem_pattern": "faE~al",
                "tag": "PV",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "بوش",
                "source_word": "",
                "lemmaid": "bawo$",
                "voc": "bawo$",
                "gloss": "mob/rabble",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "bawo$",
                "suf1": "",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "bw$",
                "stem_pattern": "faEol",
                "tag": "NOUN",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
        ],
        [
            {
                "word": ":",
                "source_word": "",
                "lemmaid": "",
                "voc": "",
                "gloss": "gloss",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": ":",
                "suf1": "Suf",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "",
                "stem_pattern": "",
                "tag": "Punc",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            }
        ],
    ]
    bw = BwSolution()
    result_words_analysis = bw.analyze_words_bw(passed_tokenized_list)
    assert result_words_analysis == expected_words_solutions_list


def test_bw_solutoins_with_word() -> None:
    passed_word = "ضمني"
    expected_word_solutions_list = [
        [
            {
                "word": "ضمني",
                "source_word": "",
                "lemmaid": "Dimoniy~",
                "voc": "Dimoniy~",
                "gloss": "implicit/tacit",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "Dimoniy~",
                "suf1": "",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "Dmn",
                "stem_pattern": "fiEoliy~",
                "tag": "ADJ",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "ضمني",
                "source_word": "",
                "lemmaid": "Dimon",
                "voc": "Dimoniy",
                "gloss": "within/inside/among + my",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "Dimon",
                "suf1": "iy/POSS_PRON_1S",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "Dmn",
                "stem_pattern": "fiEol",
                "tag": "NOUN_ADV(P)",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "ضمني",
                "source_word": "",
                "lemmaid": "Dimon",
                "voc": "Dimoniiy",
                "gloss": "within/inside/among + my",
                "pr1": "",
                "pr2": "",
                "pr3": "",
                "stem": "Dimon",
                "suf1": "iy/POSS_PRON_1S",
                "suf2": "",
                "gen": "",
                "num": "",
                "defen": "",
                "cas": "",
                "arabic_stem": "",
                "root": "Dmn",
                "stem_pattern": "fiEol",
                "tag": "NOUN",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
            {
                "word": "ضمني",
                "source_word": "",
                "lemmaid": "Dam~-u",
                "voc": "Dam~aniy",
                "gloss": "include/comprise/incorporate + he/it + me",
                "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": "faEal",
                "tag": "PV",
                "name_entities": "",
                "indexx": "",
                "affectedBy": "",
                "afterRuleSols": "",
                "Surrounds": "",
            },
        ]
    ]

    bw = BwSolution()
    result_words_analysis = bw.analyze_words_bw(passed_word)
    assert result_words_analysis == expected_word_solutions_list
