def test_get_global_variable(self): """ Test the get_global_variable of the OrderAnalyser Class """ sentence = "i am {{name2}}" variables = { "name": "LaMonf", "name2": "kalliope", "name3": u"kalliopé", "name4": 1 } st = Settings(variables=variables) expected_result = "i am kalliope" self.assertEqual(BrainLoader._get_global_variable(sentence=sentence, settings=st), expected_result) # test with accent sentence = "i am {{name3}}" expected_result = u"i am kalliopé" self.assertEqual(BrainLoader._get_global_variable(sentence=sentence, settings=st), expected_result) # test with int sentence = "i am {{name4}}" expected_result = "i am 1" self.assertEqual(BrainLoader._get_global_variable(sentence=sentence, settings=st), expected_result)
def test_get_global_variable(self): """ Test the get_global_variable of the OrderAnalyser Class """ sentence = "i am {{name2}}" variables = { "name": "LaMonf", "name2": "kalliope", } st = Settings(variables=variables) expected_result = "i am kalliope" self.assertEquals( BrainLoader._get_global_variable(sentence=sentence, settings=st), expected_result, "Fail to get the global variable from the sentence")