def test_get_namespace_from_filepath_with_filename(self): tests = { 'foo': 'foo.ja.yml', 'foo.bar': os.path.join('foo', 'bar.ja.yml'), 'foo.bar.baz': os.path.join('foo', 'bar', 'baz.en.yml'), } for expected, test_val in tests.items(): namespace = resource_loader.get_namespace_from_filepath(test_val) self.assertEqual(expected, namespace)
def test_get_namespace_from_filepath_with_filename(self): tests = { "foo": "foo.ja.yml", "foo.bar": os.path.join("foo", "bar.ja.yml"), "foo.bar.baz": os.path.join("foo", "bar", "baz.en.yml"), } for expected, test_val in tests.items(): namespace = resource_loader.get_namespace_from_filepath(test_val) self.assertEqual(expected, namespace)
def test_get_namespace_from_filepath_without_filename(self): tests = { '': 'ja.yml', 'foo': os.path.join('foo', 'ja.yml'), 'foo.bar': os.path.join('foo', 'bar', 'en.yml'), } config.set('filename_format', '{locale}.{format}') for expected, test_val in tests.items(): namespace = resource_loader.get_namespace_from_filepath(test_val) self.assertEqual(expected, namespace)
def test_get_namespace_from_filepath_without_filename(self): tests = { "": "ja.yml", "foo": os.path.join("foo", "ja.yml"), "foo.bar": os.path.join("foo", "bar", "en.yml"), } config.set("filename_format", "{locale}.{format}") for expected, test_val in tests.items(): namespace = resource_loader.get_namespace_from_filepath(test_val) self.assertEqual(expected, namespace)