lisad / phaser

The missing layer for complex data batch integration pipelines
MIT License
9 stars 1 forks source link

Column fixing values should happen BEFORE checking allowed values #142

Closed lisad closed 5 months ago

lisad commented 5 months ago

This seems like an obvious thing to want to do and should work:

@pytest.mark.skip("Column value fixing should apply BEFORE checking allowed_values")
def test_order_of_allowed_value_checking():
    col = Column('sale_type',
                 fix_value_fn='capitalize',
                 allowed_values=['Reg', 'Final', 'Exchange']
                 )
    assert col.check_and_cast_value({'sale_type': "reg"}) == {'sale_type': "Reg"}
lisad commented 5 months ago

Also while working on allowed_values there's another test already in the code waiting to be fixed:


@pytest.mark.skip("Doesn't work yet - we don't wrap the value of allowed_values in an array if it isn't one")
def test_allowed_values_cast_int_to_array():
    col2 = IntColumn(name='answer', allowed_values=42)
    col2.check_and_cast_value({'answer': '42'})