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
def test_yaml_decode(self): register_yaml() self.assertEqual(py_data, registry.decode( yaml_data, content_type='application/x-yaml', content_encoding='utf-8'))
def test_yaml_loads(self): register_yaml() self.assertEqual( py_data, loads(yaml_data, content_type='application/x-yaml', content_encoding='utf-8'), )
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'))
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'))
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"), )
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'))
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'))
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
def test_register_yaml__no_yaml(self, mask_modules): register_yaml() with pytest.raises(SerializerNotInstalled): loads('foo', 'application/x-yaml', 'utf-8')
def test_register_yaml__no_yaml(self): register_yaml() self.assertRaises(SerializerNotInstalled, decode, "foo", "application/x-yaml", "utf-8")
def test_yaml_loads(self): register_yaml() assert loads( yaml_data, content_type='application/x-yaml', content_encoding='utf-8') == py_data
def test_register_yaml__no_yaml(self): register_yaml() with pytest.raises(SerializerNotInstalled): loads('foo', 'application/x-yaml', 'utf-8')
def test_register_yaml__no_yaml(self): register_yaml() with self.assertRaises(SerializerNotInstalled): decode('foo', 'application/x-yaml', 'utf-8')