Beispiel #1
0
 def test_FromJSONEmptyObject(self):
     lmap = LanguageMap.from_json('{}')
     self.assertIsInstance(lmap, LanguageMap)
     self.assertEqual(lmap, {})
Beispiel #2
0
 def test_FromJSONExceptionBadJSON(self):
     with self.assertRaises(ValueError):
         LanguageMap.from_json('{"bad JSON"}')
Beispiel #3
0
 def test_FromJSONExceptionNestedObject(self):
     with self.assertRaises(TypeError):
         LanguageMap.from_json(
             '{"fr-CA": "test", "en-US": {"nested": "object"}}')
Beispiel #4
0
 def test_ToJSONFromJSON(self):
     json_str = '{"fr-CA": "CA-test", "en-US": "US-test", "fr-FR": "FR-test"}'
     lmap = LanguageMap.from_json(json_str)
     self.mapVerificationHelper(lmap)
     self.assertEqual(lmap.to_json(), json_str)
Beispiel #5
0
 def test_FromJSON(self):
     lmap = LanguageMap.from_json(
         '{"en-US": "US-test", "fr-CA": "CA-test", "fr-FR": "FR-test"}')
     self.mapVerificationHelper(lmap)
 def test_ToJSONFromJSON(self):
     json_str = '{"fr-CA": "CA-test", "en-US": "US-test", "fr-FR": "FR-test"}'
     lmap = LanguageMap.from_json(json_str)
     self.mapVerificationHelper(lmap)
     self.assertEqual(lmap.to_json(), json_str)
 def test_FromJSONEmptyObject(self):
     lmap = LanguageMap.from_json('{}')
     self.assertIsInstance(lmap, LanguageMap)
     self.assertEqual(lmap, {})
 def test_FromJSONExceptionNestedObject(self):
     with self.assertRaises(TypeError):
         LanguageMap.from_json('{"fr-CA": "test", "en-US": {"nested": "object"}}')
 def test_FromJSONExceptionBadJSON(self):
     with self.assertRaises(ValueError):
         LanguageMap.from_json('{"bad JSON"}')
 def test_FromJSON(self):
     lmap = LanguageMap.from_json('{"en-US": "US-test", "fr-CA": "CA-test", "fr-FR": "FR-test"}')
     self.mapVerificationHelper(lmap)