Forráskód Böngészése

[Fix] #235 manage cases in order when using parameters

monf 8 éve
szülő
commit
08d75be9d7
2 módosított fájl, 13 hozzáadás és 1 törlés
  1. 11 0
      Tests/test_order_analyser.py
  2. 2 1
      kalliope/core/OrderAnalyser.py

+ 11 - 0
Tests/test_order_analyser.py

@@ -340,6 +340,17 @@ class TestOrderAnalyser(unittest.TestCase):
         self.assertEqual(OrderAnalyser._associate_order_params_to_values(order_user, order_brain), expected_result,
                          "Fail to match the order_brain multiple variables with multiple words as values'")
 
+        ##
+        #  Specific Behaviour
+        ##
+
+        # Upper/Lower case
+        order_brain = "This Is The {{ variable }}"
+        order_user = "ThiS is tHe VAlue"
+        expected_result = {'variable': 'VAlue'}
+        self.assertEqual(OrderAnalyser._associate_order_params_to_values(order_user, order_brain), expected_result,
+                         "Fail to match the order_brain when using Upper/Lower cases")
+
     def test_get_matching_synapse_list(self):
         # Init
         neuron1 = Neuron(name='neurone1', parameters={'var1': 'val1'})

+ 2 - 1
kalliope/core/OrderAnalyser.py

@@ -211,7 +211,8 @@ class OrderAnalyser:
         the_order = order_to_check[:order_to_check.find('{{')]
 
         # remove sentence before order which are sentences not matching anyway
-        truncate_user_sentence = order[order.find(the_order):]
+        # Manage Upper/Lower case
+        truncate_user_sentence = order[order.lower().find(the_order.lower()):]
         truncate_list_word_said = truncate_user_sentence.split()
 
         # make dict var:value