def test_exception():
    serializer = JsonSerializer()
    with pytest.raises(TypeError):
        serializer.serialize_header({"sss"})

    with pytest.raises(ValueError):
        serializer.deserialize_header('{sss')

    with pytest.raises(TypeError):
        serializer.serialize_body({"sss"})

    with pytest.raises(ValueError):
        serializer.deserialize_body('{sss')
def test_exception():
    serializer = JsonSerializer()

    with pytest.raises(ValueError):
        serializer.deserialize_header('{sss')

    with pytest.raises(TypeError):
        serializer.serialize_body({"sss"})

    with pytest.raises(ValueError):
        serializer.deserialize_body('{sss')
Exemplo n.º 3
0
def test_body(v1, v2):
    serializer = JsonSerializer()
    assert v2 == serializer.serialize_body(v1)
    assert v1 == serializer.deserialize_body(v2)
Exemplo n.º 4
0
def test_header(v1):
    serializer = JsonSerializer()
    assert v1 == serializer.deserialize_header(serializer.serialize_header(v1))
def test_body(v1, v2):
    serializer = JsonSerializer()
    assert v2 == serializer.serialize_body(v1)
    assert v1 == serializer.deserialize_body(v2)
def test_header(v1):
    serializer = JsonSerializer()
    assert v1 == serializer.deserialize_header(
        serializer.serialize_header(v1)
    )
def test_header(v1, v2):
    serializer = JsonSerializer()
    assert v2 == serializer.serialize_header(v1)
    assert v1 == serializer.deserialize_header(v2)