Ejemplo n.º 1
0
 def test_can_add_lines(self):
     text_1 = "The wind was howling."
     text_2 = "The branches were squeaking."
     log = dialog.DialogHistory()
     log.add(line=dialog.Line(text=text_1))
     log.add(line=dialog.Line(text=text_2))
     assert len(list(log.history)) == 2
     assert [line.text for line in log.history] == [text_1, text_2]
Ejemplo n.º 2
0
 def test_can_create_with_text_and_str_author(self):
     text = "Nothing happens. Just wind blowing."
     narrator = "[NARRATOR]"
     line = dialog.Line(text=text, author=narrator)
     assert line.text == text
     assert line.author == narrator
     assert str(line) == "{}: \"{}\"".format(narrator, text)
Ejemplo n.º 3
0
 def test_can_create_with_text_and_char_author(self):
     text = "I yield to none!"
     char = actor.NonPlayerCharacter("The Unbroken")
     line = dialog.Line(text=text, author=char)
     assert line.text == text
     assert line.author == char
     assert str(line) == "{}: \"{}\"".format(char.name, text)
Ejemplo n.º 4
0
 def test_can_not_create_without_parameters(self):
     with pytest.raises(TypeError):
         line = dialog.Line()
Ejemplo n.º 5
0
 def test_can_create_with_just_text(self):
     text = "Nothing happens. Just wind blowing."
     line = dialog.Line(text=text)
     assert line.text == text
     assert line.author is None
     assert str(line) == text