Пример #1
0
def test_wrong_class():
    char = Character(type=['changeling'])
    char.validate(strict=True)
    assert not char.valid
    assert "Incorrect type 'changeling' for class 'Character': implies class 'Changeling'" in char.problems
Пример #2
0
 def test_filled_description(self):
     char = Character(description='Hi there!')
     char.validate()
     assert 'Missing description' not in char.problems
Пример #3
0
 def test_with_errors(self):
     char = Character()
     char.validate()
     assert not char.valid
Пример #4
0
 def test_nolint_without_skip(self):
     char = Character(nolint=True)
     char.validate(strict=True)
     assert 'Linting disabled, but character is visible in lists' in char.problems
Пример #5
0
 def test_invalid_until_validate_called(self):
     """Character should be invalid before first call to validate()"""
     char = Character(type=['human'], description='hi there', name=['dude'])
     assert not char.valid
     char.validate()
     assert char.valid
Пример #6
0
 def test_multiple_types(self):
     char = Character(type=['dog', 'cat'])
     char.validate(strict=True)
     assert "Too many values for tag 'type'. Limit of 1" in char.problems
Пример #7
0
 def test_unknown_tags(self):
     """Unrecognized tags should be errors with strict validation"""
     char = Character(head=['attached', 'bald'])
     char.validate(strict=True)
     assert "Unrecognized tag 'head'" in char.problems
Пример #8
0
 def test_single_type(self):
     char = Character(type=['dog'])
     char.validate(strict=True)
     assert "Multiple types" not in char.problems
Пример #9
0
 def test_required_tag_whitespace(self, tag):
     char = Character(**{tag: [' \t']})
     char.validate()
     assert "No values for tag '{}'".format(tag) in char.problems
Пример #10
0
 def test_required_tag_not_present(self, tag):
     char = Character(**{tag: []})
     char.validate()
     assert "No values for tag '{}'".format(tag) in char.problems
Пример #11
0
 def test_whitespace_description(self):
     char = Character(description=' \t')
     char.validate()
     assert "No values for tag 'description'" in char.problems
Пример #12
0
 def test_blank_description(self):
     char = Character(description='')
     char.validate()
     assert "No values for tag 'description'" in char.problems