Exemplo n.º 1
0
    def test_decode_numeric_error():
        """ Test that the JsonDeserializer.decode_numeric raises an error if no decoding is defined. """
        # Arrange
        value = {"numeric": "decimal", "value": "3.14"}

        # Act & Assert
        with pytest.raises(NotImplementedError):
            JsonDeserializer.decode_numeric(value)
Exemplo n.º 2
0
    def test_decode_path_error():
        """ Test that the JsonDeserializer.decode_collection raises an error if no decoding is defined. """
        # Arrange
        value = {"foo": "bar"}

        # Act & Assert
        with pytest.raises(NotImplementedError):
            JsonDeserializer.decode_path(value)
Exemplo n.º 3
0
    def test_decode_numeric(expected, value):
        """ Test that the JsonDeserializer.decode_numeric decodes values as expected. """
        # Arrange

        # Act
        result = JsonDeserializer.decode_numeric(value)

        # Assert
        assert result == expected
Exemplo n.º 4
0
    def test_decode_path(value, expected):
        """ Test that the JsonDeserializer.decode_collection decodes collections as expected. """
        # Arrange

        # Act
        result = JsonDeserializer.decode_path(value)

        # Assert
        assert result == expected
Exemplo n.º 5
0
    def test_decode_datetime(value, expected):
        """ Test that the JsonDeserializer.decode_datetime decodes values as expected. """
        # Arrange

        # Act
        result = JsonDeserializer.decode_datetime(value)

        # Assert
        assert result == expected