Пример #1
0
    def test_get_field_by_attribute(self):
        """
        tests the fields can also be obtained by the attributes that are
        set to True.
        get_field_by_attribute function
        """
        _state = State(read=read, update=update, save=save)
        _state.add_field(Field('test', isdatafile=True))

        for field in _state.get_field_by_attribute('read'):
            assert field.name in read

        for field in _state.get_field_by_attribute('update'):
            assert field.name in update

        for field in _state.get_field_by_attribute('save'):
            assert field.name in save

        for field in _state.get_field_by_attribute('isdatafile'):
            assert field.name in ['test']
Пример #2
0
def test_get_field_by_attribute():
    """
    tests the fields can also be obtained by the attributes that are
    set to True.
    get_field_by_attribute function
    """

    state = State(read=read, update=update, create=create)
    state.add_field(Field("test", isdatafile=True))

    for field in state.get_field_by_attribute("read"):
        assert field.name in read

    for field in state.get_field_by_attribute("update"):
        assert field.name in update

    for field in state.get_field_by_attribute("create"):
        assert field.name in create

    for field in state.get_field_by_attribute("isdatafile"):
        assert field.name in ["test"]