def it_accepts_list_types():
        result = validate_list(['choice', 'another_choice'])
        assert result == ['choice', 'another_choice']

        result = validate_list(('choice', 'another_choice'))
        assert result == ['choice', 'another_choice']

        def iterator():
            yield 'choice'

        result = validate_list(iterator())
        assert result == ['choice']

        with raises(ValidationError) as excinfo:
            validate_choice('c', 'abc')
        assert excinfo.value.code == INVALID_LIST
Esempio n. 2
0
    def it_accepts_list_types():
        result = validate_list(['choice', 'another_choice'])
        assert result == ['choice', 'another_choice']

        result = validate_list(('choice', 'another_choice'))
        assert result == ['choice', 'another_choice']

        def iterator():
            yield 'choice'

        result = validate_list(iterator())
        assert result == ['choice']

        with raises(ValidationError) as excinfo:
            validate_choice('c', 'abc')
        assert excinfo.value.code == INVALID_LIST
 def it_rejects_string_types():
     with raises(ValidationError) as excinfo:
         result = validate_list('choice')
     assert excinfo.value.code == INVALID_LIST
Esempio n. 4
0
 def it_rejects_string_types():
     with raises(ValidationError) as excinfo:
         result = validate_list('choice')
     assert excinfo.value.code == INVALID_LIST
Esempio n. 5
0
 def test_it_rejects_string_types(self):
     with raises(ValidationError) as excinfo:
         validate_list('choice')
     assert excinfo.value.code == INVALID_LIST
 def test_it_rejects_string_types(self):
     with raises(ValidationError) as excinfo:
         validate_list('choice')
     assert excinfo.value.code == INVALID_LIST