Explorar o código

[Test] Fix warning on deprecated method

monf %!s(int64=8) %!d(string=hai) anos
pai
achega
97940b21b2

+ 24 - 24
Tests/test_brain_loader.py

@@ -183,10 +183,10 @@ class TestBrainLoader(unittest.TestCase):
             'var1': 'test'
         }
 
-        self.assertEquals(BrainLoader._replace_global_variables(parameter=parameters,
+        self.assertEqual(BrainLoader._replace_global_variables(parameter=parameters,
                                                                 settings=st),
-                          expected_parameters,
-                          "Fail to assign a single global variable to parameters")
+                         expected_parameters,
+                         "Fail to assign a single global variable to parameters")
 
         # 2/ global variable with string after
         parameters = {
@@ -202,10 +202,10 @@ class TestBrainLoader(unittest.TestCase):
             'var1': 'test Sispheor'
         }
 
-        self.assertEquals(BrainLoader._replace_global_variables(parameter=parameters,
+        self.assertEqual(BrainLoader._replace_global_variables(parameter=parameters,
                                                                 settings=st),
-                          expected_parameters,
-                          "Fail to assign a global variable with string after to parameters")
+                         expected_parameters,
+                         "Fail to assign a global variable with string after to parameters")
 
         # 3/ global variable with int after
         parameters = {
@@ -221,10 +221,10 @@ class TestBrainLoader(unittest.TestCase):
             'var1': '600'
         }
 
-        self.assertEquals(BrainLoader._replace_global_variables(parameter=parameters,
+        self.assertEqual(BrainLoader._replace_global_variables(parameter=parameters,
                                                                 settings=st),
-                          expected_parameters,
-                          "Fail to assign global variable with int after to parameters")
+                         expected_parameters,
+                         "Fail to assign global variable with int after to parameters")
 
         # 4/ multiple global variables
         parameters = {
@@ -240,10 +240,10 @@ class TestBrainLoader(unittest.TestCase):
             'var1': 'hello LaMonf'
         }
 
-        self.assertEquals(BrainLoader._replace_global_variables(parameter=parameters,
+        self.assertEqual(BrainLoader._replace_global_variables(parameter=parameters,
                                                                 settings=st),
-                          expected_parameters,
-                          "Fail to assign multiple global variables to parameters")
+                         expected_parameters,
+                         "Fail to assign multiple global variables to parameters")
 
         # 5/ parameter value is a list
         parameters = {
@@ -259,10 +259,10 @@ class TestBrainLoader(unittest.TestCase):
             'var1': '[hello LaMonf, bonjour LaMonf]'
         }
 
-        self.assertEquals(BrainLoader._replace_global_variables(parameter=parameters,
+        self.assertEqual(BrainLoader._replace_global_variables(parameter=parameters,
                                                                 settings=st),
-                          expected_parameters,
-                          "Fail to assign a single global when parameter value is a list to neuron")
+                         expected_parameters,
+                         "Fail to assign a single global when parameter value is a list to neuron")
 
         # 6/ parameter is a dict
         parameters = {'from_answer_link': [{'synapse': 'synapse2', 'answers': ['absolument', '{{ name }}']},
@@ -279,10 +279,10 @@ class TestBrainLoader(unittest.TestCase):
                 {'synapse': 'synapse3', 'answers': ['nico']}], 'default': 'synapse4'
         }
 
-        self.assertEquals(BrainLoader._replace_global_variables(parameter=parameters,
+        self.assertEqual(BrainLoader._replace_global_variables(parameter=parameters,
                                                                 settings=st),
-                          expected_parameters,
-                          "Fail to assign a single global when parameter value is a list to neuron")
+                         expected_parameters,
+                         "Fail to assign a single global when parameter value is a list to neuron")
 
     def test_get_global_variable(self):
         """
@@ -299,25 +299,25 @@ class TestBrainLoader(unittest.TestCase):
 
         expected_result = "i am kalliope"
 
-        self.assertEquals(BrainLoader._get_global_variable(sentence=sentence,
+        self.assertEqual(BrainLoader._get_global_variable(sentence=sentence,
                                                            settings=st),
-                          expected_result)
+                         expected_result)
 
         # test with accent
         sentence = "i am {{name3}}"
         expected_result = u"i am kalliopé"
 
-        self.assertEquals(BrainLoader._get_global_variable(sentence=sentence,
+        self.assertEqual(BrainLoader._get_global_variable(sentence=sentence,
                                                            settings=st),
-                          expected_result)
+                         expected_result)
 
         # test with int
         sentence = "i am {{name4}}"
         expected_result = "i am 1"
 
-        self.assertEquals(BrainLoader._get_global_variable(sentence=sentence,
+        self.assertEqual(BrainLoader._get_global_variable(sentence=sentence,
                                                            settings=st),
-                          expected_result)
+                         expected_result)
 
 
 if __name__ == '__main__':

+ 6 - 6
Tests/test_neuron_parameter_loader.py

@@ -11,9 +11,9 @@ class TestNeuronParameterLoader(unittest.TestCase):
         user_order = "this is the value"
         expected_result = {'sentence': 'value'}
 
-        self.assertEquals(NeuronParameterLoader.get_parameters(synapse_order=synapse_order, user_order=user_order),
-                          expected_result,
-                          "Fail to retrieve 'the params' of the synapse_order from the order")
+        self.assertEqual(NeuronParameterLoader.get_parameters(synapse_order=synapse_order, user_order=user_order),
+                         expected_result,
+                         "Fail to retrieve 'the params' of the synapse_order from the order")
 
         # Multiple match
         synapse_order = "this is the {{ sentence }}"
@@ -30,7 +30,7 @@ class TestNeuronParameterLoader(unittest.TestCase):
 
         user_order = "this is the value with multiple words"
         expected_result = {'sentence': 'value',
-                            'params':'words'}
+                           'params':'words'}
 
         self.assertEqual(NeuronParameterLoader.get_parameters(synapse_order=synapse_order, user_order=user_order),
                          expected_result,
@@ -101,14 +101,14 @@ class TestNeuronParameterLoader(unittest.TestCase):
         order_brain = "This is the {variable}"
         order_user = "This is the value"
         expected_result = {'variable': 'value'}
-        self.assertNotEquals(NeuronParameterLoader._associate_order_params_to_values(order_user, order_brain),
+        self.assertNotEqual(NeuronParameterLoader._associate_order_params_to_values(order_user, order_brain),
                              expected_result)
 
         # Fail
         order_brain = "This is the { variable}}"
         order_user = "This is the value"
         expected_result = {'variable': 'value'}
-        self.assertNotEquals(NeuronParameterLoader._associate_order_params_to_values(order_user, order_brain),
+        self.assertNotEqual(NeuronParameterLoader._associate_order_params_to_values(order_user, order_brain),
                              expected_result)
 
         ##

+ 3 - 3
Tests/test_order_listener.py

@@ -39,9 +39,9 @@ class TestOrderListener(unittest.TestCase):
 
         with mock.patch("kalliope.core.Utils.get_dynamic_class_instantiation") as mock_get_dynamic_class_instantiation:
             mock_get_dynamic_class_instantiation.return_value = 'class_instance'
-            self.assertEquals(ol.load_stt_plugin(),
-                              "class_instance",
-                              "Fail getting the proper value")
+            self.assertEqual(ol.load_stt_plugin(),
+                             "class_instance",
+                             "Fail getting the proper value")
 
             mock_get_dynamic_class_instantiation.assert_called_once_with(package_name= "stt",
                                                                          module_name= "Default-stt",

+ 1 - 1
Tests/test_settings_loader.py

@@ -191,7 +191,7 @@ class TestSettingLoader(unittest.TestCase):
                               trigger_folder="/tmp/kalliope/tests/kalliope_resources_dir/trigger")
         expected_resource = resources
         sl = SettingLoader(file_path=self.settings_file_to_test)
-        self.assertEquals(expected_resource, sl._get_resources(self.settings_dict))
+        self.assertEqual(expected_resource, sl._get_resources(self.settings_dict))
 
     def test_get_variables(self):
         expected_result = {

+ 6 - 6
Tests/test_tts_module.py

@@ -25,9 +25,9 @@ class TestTTSModule(unittest.TestCase):
         word = "kalliope"
         expected_result = "5c186d1e123be2667fb5fd54640e4fd0"
 
-        self.assertEquals(TTSModule.generate_md5_from_words(words=word),
-                          expected_result,
-                          "Fail md5")
+        self.assertEqual(TTSModule.generate_md5_from_words(words=word),
+                         expected_result,
+                         "Fail md5")
 
     def test_get_path_to_store_audio(self):
         """
@@ -40,9 +40,9 @@ class TestTTSModule(unittest.TestCase):
 
         expected_result = "/tmp/kalliope/tests/TTSModule/tests/default/5c186d1e123be2667fb5fd54640e4fd0.tts"
 
-        self.assertEquals(self.TTSMod._get_path_to_store_audio(),
-                          expected_result,
-                          "fail test_get_path_to_store_audio, expected path not corresponding to result")
+        self.assertEqual(self.TTSMod._get_path_to_store_audio(),
+                         expected_result,
+                         "fail test_get_path_to_store_audio, expected path not corresponding to result")
 
     def test_generate_and_play(self):
         """

+ 15 - 15
Tests/test_utils.py

@@ -26,9 +26,9 @@ class TestUtils(unittest.TestCase):
         path_to_test = "../kalliope/core/Utils"
         expected_result = os.path.normpath("../kalliope/core")
 
-        self.assertEquals(Utils.get_current_file_parent_path(path_to_test),
-                          expected_result,
-                          "fail getting the parent parent path from the given path")
+        self.assertEqual(Utils.get_current_file_parent_path(path_to_test),
+                         expected_result,
+                         "fail getting the parent parent path from the given path")
 
     def test_get_current_file_parent_parent_path(self):
         """
@@ -37,9 +37,9 @@ class TestUtils(unittest.TestCase):
         path_to_test = "../kalliope/core/Utils"
         expected_result = os.path.normpath("../kalliope")
 
-        self.assertEquals(Utils.get_current_file_parent_parent_path(path_to_test),
-                          expected_result,
-                          "fail getting the parent parent path from the given path")
+        self.assertEqual(Utils.get_current_file_parent_parent_path(path_to_test),
+                         expected_result,
+                         "fail getting the parent parent path from the given path")
 
     def test_get_real_file_path(self):
         """
@@ -61,9 +61,9 @@ class TestUtils(unittest.TestCase):
         # touch the file
         open(absolute_path_to_test, 'a').close()
 
-        self.assertEquals(Utils.get_real_file_path(absolute_path_to_test),
-                          expected_result,
-                          "Fail to match the given absolute path ")
+        self.assertEqual(Utils.get_real_file_path(absolute_path_to_test),
+                         expected_result,
+                         "Fail to match the given absolute path ")
         # Clean up
         if os.path.exists(absolute_path_to_test):
             os.remove(absolute_path_to_test)
@@ -76,9 +76,9 @@ class TestUtils(unittest.TestCase):
         # touch the file
         open(file_name, 'a').close()
 
-        self.assertEquals(Utils.get_real_file_path(file_name),
-                          expected_result,
-                          "Fail to match the Current path ")
+        self.assertEqual(Utils.get_real_file_path(file_name),
+                         expected_result,
+                         "Fail to match the Current path ")
         # Clean up
         if os.path.exists(file_name):
             os.remove(file_name)
@@ -115,9 +115,9 @@ class TestUtils(unittest.TestCase):
         # touch the file
         open(path_to_test, 'a').close()
 
-        self.assertEquals(Utils.get_real_file_path(file_name),
-                          expected_result,
-                          "Fail to match the /an/unknown/path/kalliope path")
+        self.assertEqual(Utils.get_real_file_path(file_name),
+                         expected_result,
+                         "Fail to match the /an/unknown/path/kalliope path")
         # Clean up
         if os.path.exists(expected_result):
             os.remove(expected_result)