def test_decode_decimal_scalar_when_codec_is_none():
    """Decoding a row that has a field with the codec set to None. The type should be deduced automatically
    from UnischemaField's numpy_dtype attribute if the type is either a numpy scalar or a Decimal"""

    MatrixSchema = Unischema('TestSchema', [UnischemaField('scalar', Decimal, ())])

    row = {'scalar': '123.45'}
    decoded_value = decode_row(row, MatrixSchema)['scalar']
    assert decoded_value == Decimal('123.45')
    assert isinstance(decoded_value, Decimal)

    row = {'scalar': Decimal('123.45')}
    decoded_value = decode_row(row, MatrixSchema)['scalar']
    assert decoded_value == Decimal('123.45')
    assert isinstance(decoded_value, Decimal)
Decoding a row that has a field with the codec set to None. The type should be deduced automatically
    from UnischemaField's numpy_dtype attribute if the type is either a numpy scalar or a Decimal
petastorm/tests/test_decode_row.py