Esempio n. 1
0
    def integer_marshalling(self, fixture):
        field = IntegerField()
        obj = EmptyStub()
        field.bind('integer_value', obj)

        # From input
        field.from_input('5')
        vassert( obj.integer_value is 5 )

        # As input
        obj.integer_value = 6
        vassert( field.as_input() == '6' )

        # As input - corner case
        obj.integer_value = 0
        vassert( field.as_input() == '0' )
Esempio n. 2
0
def test_integer_marshalling(fixture):

    field = IntegerField()
    obj = EmptyStub()
    field.bind('integer_value', obj)

    # From input
    field.from_input('5')
    assert obj.integer_value is 5

    # As input
    obj.integer_value = 6
    assert field.as_input() == '6'

    # As input - corner case
    obj.integer_value = 0
    assert field.as_input() == '0'