def test_load_translations_files(hass): """Test the load translation files function.""" # Test one valid and one invalid file file1 = hass.config.path( "custom_components", "test", "translations", "switch.en.json" ) file2 = hass.config.path( "custom_components", "test", "translations", "invalid.json" ) assert translation.load_translations_files( {"switch.test": file1, "invalid": file2} ) == { "switch.test": { "state": {"string1": "Value 1", "string2": "Value 2"}, "something": "else", }, "invalid": {}, }
def test_load_translations_files(hass): """Test the load translation files function.""" # Test one valid and one invalid file file1 = hass.config.path('custom_components', 'switch', '.translations', 'test.en.json') file2 = hass.config.path('custom_components', 'switch', '.translations', 'invalid.json') assert translation.load_translations_files({ 'switch.test': file1, 'invalid': file2 }) == { 'switch.test': { 'state': { 'string1': 'Value 1', 'string2': 'Value 2', } }, 'invalid': {}, }
def test_load_translations_files(hass): """Test the load translation files function.""" # Test one valid and one invalid file file1 = hass.config.path( 'custom_components', 'switch', '.translations', 'test.en.json') file2 = hass.config.path( 'custom_components', 'switch', '.translations', 'invalid.json') assert translation.load_translations_files({ 'switch.test': file1, 'invalid': file2 }) == { 'switch.test': { 'state': { 'string1': 'Value 1', 'string2': 'Value 2', } }, 'invalid': {}, }