Пример #1
0
 def test_yaml_loads(self):
     pytest.importorskip('yaml')
     register_yaml()
     assert loads(
         yaml_data,
         content_type='application/x-yaml',
         content_encoding='utf-8') == py_data
Пример #2
0
 def test_yaml_decode(self):
     register_yaml()
     self.assertEqual(py_data,
                       registry.decode(
                           yaml_data,
                           content_type='application/x-yaml',
                           content_encoding='utf-8'))
Пример #3
0
 def test_yaml_loads(self):
     register_yaml()
     self.assertEqual(
         py_data,
         loads(yaml_data,
               content_type='application/x-yaml',
               content_encoding='utf-8'),
     )
Пример #4
0
 def test_yaml_loads(self):
     register_yaml()
     self.assertEqual(
         py_data,
         loads(yaml_data,
               content_type='application/x-yaml',
               content_encoding='utf-8'),
     )
Пример #5
0
 def test_yaml_encode(self):
     register_yaml()
     self.assertEqual(
         registry.decode(registry.encode(py_data, serializer="yaml")[-1],
                         content_type='application/x-yaml',
                         content_encoding='utf-8'),
         registry.decode(yaml_data,
                         content_type='application/x-yaml',
                         content_encoding='utf-8'))
Пример #6
0
 def test_yaml_encode(self):
     register_yaml()
     self.assertEqual(registry.decode(
                           registry.encode(py_data, serializer='yaml')[-1],
                           content_type='application/x-yaml',
                           content_encoding='utf-8'),
                       registry.decode(
                           yaml_data,
                           content_type='application/x-yaml',
                           content_encoding='utf-8'))
Пример #7
0
 def test_yaml_encode(self):
     register_yaml()
     self.assertEqual(
         registry.decode(
             registry.encode(py_data, serializer="yaml")[-1],
             content_type="application/x-yaml",
             content_encoding="utf-8",
         ),
         registry.decode(yaml_data, content_type="application/x-yaml", content_encoding="utf-8"),
     )
Пример #8
0
 def test_yaml_decode(self):
     register_yaml()
     try:
         __import__("yaml")
     except ImportError:
         say("* PyYAML not installed, will not execute related tests.")
         raise SkipTest("PyYAML not installed")
     self.assertEquals(
         py_data,
         registry.decode(yaml_data,
                         content_type='application/x-yaml',
                         content_encoding='utf-8'))
Пример #9
0
 def test_yaml_decode(self):
     register_yaml()
     try:
         __import__("yaml")
     except ImportError:
         say("* PyYAML not installed, will not execute related tests.")
         raise SkipTest("PyYAML not installed")
     self.assertEquals(py_data,
                       registry.decode(
                           yaml_data,
                           content_type='application/x-yaml',
                           content_encoding='utf-8'))
Пример #10
0
 def test_yaml_dumps(self):
     register_yaml()
     a = loads(
         dumps(py_data, serializer='yaml')[-1],
         content_type='application/x-yaml',
         content_encoding='utf-8',
     )
     b = loads(
         yaml_data,
         content_type='application/x-yaml',
         content_encoding='utf-8',
     )
     assert a == b
Пример #11
0
 def test_yaml_dumps(self):
     register_yaml()
     a = loads(
         dumps(py_data, serializer='yaml')[-1],
         content_type='application/x-yaml',
         content_encoding='utf-8',
     )
     b = loads(
         yaml_data,
         content_type='application/x-yaml',
         content_encoding='utf-8',
     )
     assert a == b
Пример #12
0
 def test_register_yaml__no_yaml(self, mask_modules):
     register_yaml()
     with pytest.raises(SerializerNotInstalled):
         loads('foo', 'application/x-yaml', 'utf-8')
Пример #13
0
 def test_register_yaml__no_yaml(self):
     register_yaml()
     self.assertRaises(SerializerNotInstalled,
                       decode, "foo", "application/x-yaml", "utf-8")
Пример #14
0
 def test_yaml_loads(self):
     register_yaml()
     assert loads(
         yaml_data,
         content_type='application/x-yaml',
         content_encoding='utf-8') == py_data
Пример #15
0
 def test_register_yaml__no_yaml(self):
     register_yaml()
     with pytest.raises(SerializerNotInstalled):
         loads('foo', 'application/x-yaml', 'utf-8')
Пример #16
0
 def test_register_yaml__no_yaml(self):
     register_yaml()
     with self.assertRaises(SerializerNotInstalled):
         decode('foo', 'application/x-yaml', 'utf-8')
Пример #17
0
 def test_register_yaml__no_yaml(self):
     register_yaml()
     with self.assertRaises(SerializerNotInstalled):
         decode('foo', 'application/x-yaml', 'utf-8')
Пример #18
0
 def test_register_yaml__no_yaml(self):
     register_yaml()
     self.assertRaises(SerializerNotInstalled, decode, "foo",
                       "application/x-yaml", "utf-8")