def test_encode_path_error(value): """ Test that the JsonSerializer.encode_path raises an error if no encoding is defined. """ # Arrange value = b"foobar" # Act & Assert with pytest.raises(NotImplementedError): JsonSerializer.encode_path(value)
def test_encode_numeric_error(): """ Test that the JsonSerializer.encode_numeric raises an error if no encoding is defined. """ # Arrange value = "3.121" # Act & Assert with pytest.raises(NotImplementedError): JsonSerializer.encode_numeric(value)
def test_encode_collection_error(): """ Test that the JsonSerializer.encode_collection raises an error if no encoding is defined. """ # Arrange value = bytearray(10) # Act & Assert with pytest.raises(NotImplementedError): JsonSerializer.encode_collection(value)
def test_encode_datetime_error(): """ Test that the JsonSerializer.encode_datetime raises an error if no encoding is defined. """ # Arrange value = "not a datetime" # Act & Assert with pytest.raises(NotImplementedError): JsonSerializer.encode_datetime(value)
def test_encode_numeric(value, expected): """ Test that the JsonSerializer.encode_numeric encodes values as expected. """ # Arrange # Act result = JsonSerializer.encode_numeric(value) # Assert assert (result == expected) or (isnan(result) and isnan(expected))
def test_encode_path(value, expected): """ Test that the JsonSerializer.encode_collection encodes values as expected. """ # Arrange # Act result = JsonSerializer.encode_path(value) # Assert assert result == expected
def test_encode_datetime(value, expected): """ Test that the JsonSerializer.encode_datetime encodes values as expected. """ # Arrange # Act result = JsonSerializer.encode_datetime(value) # Assert assert result == expected