Beispiel #1
0
 def test_no_dead_section_without_dead_notes(self):
     char = Character()
     char.tags('name').append('Joe Smith')
     output = template_output(char)
     assert '*Dead:*' not in output
Beispiel #2
0
 def test_adds_aka_for_remaining_names(self):
     char = Character()
     char.tags('name').extend(['Joe Smith', 'Mr. Smith', 'The Man'])
     output = template_output(char)
     assert '*AKA Mr. Smith, The Man*' in output
Beispiel #3
0
 def test_inserts_deceased_note_if_dead(self):
     char = Character()
     char.tags('name').append('Joe Smith')
     char.tags('dead').touch()
     output = template_output(char)
     assert '# Joe Smith (Deceased)' in output
Beispiel #4
0
def test_full_sheet_formatting():
    char = Character()
    char.tags('type').append('Human')
    char.tags('name').extend(['Bob Herbson', 'Bobbie'])
    char.tags('dead').append('Perished in a teleporter accident.')
    char.tags('title').append('The Human Guinea Pig')
    char.tags('location').append('Moontown')
    char.tags('wanderer').touch()
    char.tags('group').append('Testers')
    char.tags('group').subtag('Testers').append('Chief Marshall')
    char.tags('group').append('Croquet Team')
    char.tags('group').subtag('Croquet Team').append('Water Boy')
    char.tags.add_group('motley', 'Moon Morons')
    char.tags('motley').subtag('Moon Morons').append('Fixer')
    char.tags('appearance').append('Red shirt and a goofy grin.')
    char.tags('description').append(
        'Outgoing fella with a shady hobby and no fear of death.')
    output = template_output(char)
    print(output)  # Always print the real output for when things go wrong
    expected = """\
### Bob Herbson (Deceased)

*AKA Bobbie*
The Human Guinea Pig
Human in Moontown, Wanderer, Testers (Chief Marshall), Moon Morons Motley (Fixer)
Croquet Team (Water Boy)

*Appearance:* Red shirt and a goofy grin.

*Notes:* Outgoing fella with a shady hobby and no fear of death.

*Dead:* Perished in a teleporter accident.

"""
    assert output == expected
Beispiel #5
0
 def test_uses_first_name_for_header(self):
     char = Character()
     char.tags('name').append('Joe Smith')
     output = template_output(char)
     assert '# Joe Smith' in output
Beispiel #6
0
 def test_no_section_if_not_filled(self):
     char = Character()
     output = template_output(char)
     assert '*Notes:*' not in output
Beispiel #7
0
 def test_has_section_if_filled(self):
     char = Character()
     char.tags('description').append('some guy')
     output = template_output(char)
     assert re.search(r'^\*Notes:\* some guy$', output,
                      re.MULTILINE) is not None
Beispiel #8
0
 def test_has_section_if_filled(self):
     char = Character()
     char.tags('appearance').append('grungy')
     output = template_output(char)
     assert re.search(r'^\*Appearance:\* grungy$', output,
                      re.MULTILINE) is not None
Beispiel #9
0
def test_inserts_hashes_for_header_level():
    char = Character()
    output = template_output(char, 3)
    assert re.match(r'^###', output) is not None
Beispiel #10
0
 def test_remaining_groups_in_own_section(self):
     char = Character()
     char.tags('type').append('human')
     char.tags('group').append('student council')
     char.tags('group').subtag('student council').append('president')
     char.tags('group').subtag('student council').append('member')
     char.tags('group').append('volleyball')
     char.tags('group').subtag('volleyball').append('star')
     char.tags('group').append('chess club')
     char.tags('group').subtag('chess club').append('newbie')
     output = template_output(char)
     assert re.search(r'^volleyball \(star\), chess club \(newbie\)$',
                      output, re.MULTILINE) is not None