示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
 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)
示例#6
0
 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)