Exemplo n.º 1
0
 def test_common_1(self):
     """Test Case: common eng-spa -> No"""
     model_test = Model()
     data_pool = [
         '+ etymological_origin_of(" taco",fin," burrito",fin)',
         '+ etymological_origin_of(" taco",eng," burrito",eng)',
         '+ etymological_origin_of(" taco",deu," burrito",deu)'
     ]
     model_test.append_data(data_pool)
     model_test.load(Dummy())
     relations = {
         'derived': False,
         'etymologically': False,
         'etymology': False,
         'etymologically_related': False,
         'has_derived_form': False,
         'etymological_origin_of': True,
         'is_derived_from': False,
         'variant': False
     }
     result = g08_logic_i_i.common(
         "-",
         "-",
         "eng",
         "fin",
         Dummy(),
         model_test.get_logic(),  # data
         relations)
     expected_result = True
     assert result == expected_result
Exemplo n.º 2
0
 def test_cousin_level_3(self):
     """Test Case: hijo cousin level of primo? -> 1"""
     model_test = Model()
     data_pool = [
         '+ etymological_origin_of(" abuelo",spa," padre",spa)',
         '+ etymological_origin_of(" abuelo",spa," tio",spa)',
         '+ etymological_origin_of(" padre",spa," hijo",spa)',
         '+ etymological_origin_of(" tio",spa," primo",spa)'
     ]
     model_test.append_data(data_pool)
     model_test.load(Dummy())
     relations = {
         'derived': False,
         'etymologically': False,
         'etymology': False,
         'etymologically_related': False,
         'has_derived_form': False,
         'etymological_origin_of': True,
         'is_derived_from': False,
         'variant': False
     }
     result = g08_logic_w_w.cousin_level(
         "hijo",
         "spa",
         "primo",
         "spa",
         Dummy(),
         model_test.get_logic(),  # data
         relations)
     expected_result = True
     assert result == expected_result
Exemplo n.º 3
0
 def test_uncle_3(self):
     """Test Case: "tio" is uncle of "sobrino"? -> Yes"""
     model_test = Model()
     data_pool = [
         '+ etymological_origin_of(" abuelo",spa," padre",spa)',
         '+ etymological_origin_of(" abuelo",spa," tio",spa)',
         '+ etymological_origin_of(" padre",spa," sobrino",spa)'
     ]
     model_test.append_data(data_pool)
     model_test.load(Dummy())
     relations = {
         'derived': False,
         'etymologically': False,
         'etymology': False,
         'etymologically_related': False,
         'has_derived_form': False,
         'etymological_origin_of': True,
         'is_derived_from': False,
         'variant': False
     }
     result = g08_logic_w_w.uncle(
         "tio",
         "spa",
         "sobrino",
         "spa",
         Dummy(),
         model_test.get_logic(),  # data
         relations)
     expected_result = True
     assert result == expected_result
Exemplo n.º 4
0
 def test_originated_1(self):
     """Test Case: words in spa originated from primo(rus)? -> Yes"""
     model_test = Model()
     data_pool = [
         '+ etymological_origin_of(" tio",rus," primo",rus)',
         '+ etymological_origin_of(" primo",rus," primos",spa)']
     model_test.append_data(data_pool)
     model_test.load(Dummy())
     relations = {
         'derived': False,
         'etymologically': False,
         'etymology': False,
         'etymologically_related': False,
         'has_derived_form': False,
         'etymological_origin_of': True,
         'is_derived_from': False,
         'variant': False}
     result = g08_logic_i_w.originated(
         "-",
         "spa",
         "primo",
         "rus    ",
         Dummy(),
         model_test.get_logic(),  # data
         relations)
     expected_result = True
     assert result == expected_result
Exemplo n.º 5
0
 def test_related_2(self):
     """Test Case: spa is related to primo? -> No"""
     model_test = Model()
     data_pool = [
         '+ etymological_origin_of(" abuelo",spa," padre",spa)',
         '+ etymological_origin_of(" abuelo",spa," tio",spa)',
         '+ etymological_origin_of(" padre",spa," hijo",spa)',
         '+ etymological_origin_of(" tio",rus," primo",rus)']
     model_test.append_data(data_pool)
     model_test.load(Dummy())
     relations = {
         'derived': False,
         'etymologically': False,
         'etymology': False,
         'etymologically_related': False,
         'has_derived_form': False,
         'etymological_origin_of': True,
         'is_derived_from': False,
         'variant': False}
     result = g08_logic_i_w.related(
         "-",
         "spa",
         "primo",
         "rus",
         Dummy(),
         model_test.get_logic(),  # data
         relations)
     expected_result = False
     assert result == expected_result
Exemplo n.º 6
0
 def test_listing_2(self):
     """Test Case: idioms related to tio(spa)? -> No"""
     model_test = Model()
     data_pool = [
         '+ etymological_origin_of(" tio",spa," primo",rus)',
         '+ etymological_origin_of(" trio",afr," tia",spa)']
     model_test.append_data(data_pool)
     model_test.load(Dummy())
     relations = {
         'derived': False,
         'etymologically': False,
         'etymology': False,
         'etymologically_related': False,
         'has_derived_form': False,
         'etymological_origin_of': True,
         'is_derived_from': False,
         'variant': False}
     result = g08_logic_i_w.listing(
         "-",
         "-",
         "tia",
         "rus",
         Dummy(),
         model_test.get_logic(),  # data
         relations)
     expected_result = False
     assert result == expected_result
Exemplo n.º 7
0
    def test_clear(self):
        """Tests if the data appends correctly to a model"""
        test_model = Model()
        logics = {}
        logics[
            "afr_etymological_origin_of_fin"] = """+ etymological_origin_of(" apartheid",afr," apartheid",fin)"""
        logics[
            "afr_etymological_origin_of_rus"] = """+ etymological_origin_of(" apartheid",afr," апартеид",rus)"""

        test_model.append_data(logics["afr_etymological_origin_of_fin"])
        test_model.append_data(logics["afr_etymological_origin_of_rus"])

        test_model.clear()

        assert test_model.data == ""
Exemplo n.º 8
0
    def test_appender(self):
        """Tests if the data appends correctly to a model"""
        test_model_manual = Model()
        logics = {}
        logics[
            "afr_etymological_origin_of_fin"] = """+ etymological_origin_of(" apartheid",afr," apartheid",fin)"""
        logics[
            "afr_etymological_origin_of_rus"] = """+ etymological_origin_of(" apartheid",afr," апартеид",rus)"""

        test_model_manual.append_data(logics["afr_etymological_origin_of_fin"])
        test_model_manual.append_data(logics["afr_etymological_origin_of_rus"])
        result_1 = test_model_manual.data

        test_model_pool = Model()
        data_pool = []
        data_pool.append(logics["afr_etymological_origin_of_fin"])
        data_pool.append(logics["afr_etymological_origin_of_rus"])

        test_model_pool.append_data(data_pool)
        result_2 = test_model_pool.data
        assert result_1 == result_2