Repository: missionpinball/mpf

Issue:
String placeholders are lower cased. Support uppercase strings
Fix and test

Discussion:

Patch:
diff --git a/mpf/_version.py b/mpf/_version.py
index 11d3ee171..d79f94544 100644
--- a/mpf/_version.py
+++ b/mpf/_version.py
@@ -10,7 +10,7 @@ PyPI.
 
 """
 
-__version__ = '0.50.0-dev.44'
+__version__ = '0.50.0-dev.43'
 '''The full version of MPF.'''
 
 __short_version__ = '0.50'
diff --git a/mpf/core/config_processor.py b/mpf/core/config_processor.py
index 95868ca8b..56b8ad0fc 100755
--- a/mpf/core/config_processor.py
+++ b/mpf/core/config_processor.py
@@ -26,6 +26,9 @@ class ConfigProcessor(object):
         if not ConfigValidator.config_spec:
             ConfigValidator.load_config_spec()
 
+        if not config:
+            return dict()
+
         for k in config.keys():
             try:
                 if config_type not in ConfigValidator.config_spec[k][
diff --git a/mpf/core/data_manager.py b/mpf/core/data_manager.py
index b06683d07..42f5a4f39 100644
--- a/mpf/core/data_manager.py
+++ b/mpf/core/data_manager.py
@@ -73,6 +73,9 @@ class DataManager(MpfController):
             self.debug_log("Didn't find the %s file. No prob. We'll create "
                            "it when we save.", self.name)
 
+        if not self.data:
+            self.data = {}
+
     def get_data(self, section=None):
         """Return the value of this DataManager's data.
 
diff --git a/mpf/core/machine.py b/mpf/core/machine.py
index ea4067514..b6e542940 100644
--- a/mpf/core/machine.py
+++ b/mpf/core/machine.py
@@ -698,8 +698,7 @@ class MachineController(LogMixin):
         self.info_log("Starting the main run loop.")
         try:
             init = Util.ensure_future(self.initialise(), loop=self.clock.loop)
-            self.clock.loop.run_until_complete(Util.first([init, self.stop_future], cancel_others=False,
-                                                          loop=self.clock.loop))
+            self.clock.loop.run_until_complete(Util.first([init, self.stop_future], loop=self.clock.loop))
         except RuntimeError:
             # do not show a runtime useless runtime error
             self.error_log("Failed to initialise MPF")
diff --git a/mpf/file_interfaces/yaml_interface.py b/mpf/file_interfaces/yaml_interface.py
index 4be0ba59c..e68a4b31d 100644
--- a/mpf/file_interfaces/yaml_interface.py
+++ b/mpf/file_interfaces/yaml_interface.py
@@ -275,7 +275,7 @@ class YamlInterface(FileInterface):
     @staticmethod
     def process(data_string: Iterable[str]) -> dict:
         """Parse yaml from a string."""
-        return Util.keys_to_lower(yaml.load(data_string, Loader=MpfLoader))
+        return yaml.load(data_string, Loader=MpfLoader)
 
     def save(self, filename: str, data: dict) -> None:   # pragma: no cover
         """Save config to yaml file."""


Test patch:
diff --git a/mpf/tests/machine_files/config_interface/config/test_config_interface.yaml b/mpf/tests/machine_files/config_interface/config/test_config_interface.yaml
index f5a729241..20966a09a 100644
--- a/mpf/tests/machine_files/config_interface/config/test_config_interface.yaml
+++ b/mpf/tests/machine_files/config_interface/config/test_config_interface.yaml
@@ -26,6 +26,3 @@ test_section:
   case_sensitive_1: test
   Case_sensitive_2: test
   case_sensitive_3: Test
-
-Test_section_1:
-  test: test
diff --git a/mpf/tests/machine_files/p_roc/config/config.yaml b/mpf/tests/machine_files/p_roc/config/config.yaml
index 3e718b0f0..c35357873 100644
--- a/mpf/tests/machine_files/p_roc/config/config.yaml
+++ b/mpf/tests/machine_files/p_roc/config/config.yaml
@@ -4,7 +4,7 @@ hardware:
     driverboards: pdb
     platform: p_roc
 
-P_ROC:
+p_roc:
   dmd_timing_cycles: 1, 2, 3, 4
 
 switches:
diff --git a/mpf/tests/machine_files/shows/config/test_shows.yaml b/mpf/tests/machine_files/shows/config/test_shows.yaml
index f6235c992..c17e8c680 100644
--- a/mpf/tests/machine_files/shows/config/test_shows.yaml
+++ b/mpf/tests/machine_files/shows/config/test_shows.yaml
@@ -171,8 +171,8 @@ show_player:
     show_assoc_tokens:
       speed: 1
       show_tokens:
-         line1Num: tag1
-         line1Color: red
+         line1num: tag1
+         line1color: red
   stop_show_assoc_tokens:
     show_assoc_tokens:
       action: stop
diff --git a/mpf/tests/test_Config.py b/mpf/tests/test_Config.py
index 97014c7b1..9246105be 100644
--- a/mpf/tests/test_Config.py
+++ b/mpf/tests/test_Config.py
@@ -14,8 +14,6 @@ class TestConfig(MpfTestCase):
 
         self.add_to_config_validator('test_section',
                                      dict(__valid_in__='machine'))
-        self.add_to_config_validator('test_section_1',
-                                     dict(__valid_in__='machine'))
 
         super().setUp()
 
@@ -49,19 +47,16 @@ class TestConfig(MpfTestCase):
         self.assertEqual('+5', self.machine.config['test_section']['str_plus5'])
         self.assertEqual('+0.5', self.machine.config['test_section']['str_plus0point5'])
 
-        # keys should be all lowercase
+        # keys should keep case
         self.assertIn('case_sensitive_1', self.machine.config['test_section'])
-        self.assertIn('case_sensitive_2', self.machine.config['test_section'])
+        self.assertIn('Case_sensitive_2', self.machine.config['test_section'])
         self.assertIn('case_sensitive_3', self.machine.config['test_section'])
 
         # values should be case sensitive
         self.assertEqual(self.machine.config['test_section']['case_sensitive_1'], 'test')
-        self.assertEqual(self.machine.config['test_section']['case_sensitive_2'], 'test')
+        self.assertEqual(self.machine.config['test_section']['Case_sensitive_2'], 'test')
         self.assertEqual(self.machine.config['test_section']['case_sensitive_3'], 'Test')
 
-        # key should be lowercase even though it's uppercase in the config
-        self.assertIn('test_section_1', self.machine.config)
-
     def test_config_validator(self):
         validation_failure_info = (("key", "entry"), "subkey")
         # test config spec syntax error