Пример #1
0
 def test__write_Should_CallExpected_When_NoTtyButForce(self, print_patch, stderr_patch, *patches):
     stderr_patch.isatty.return_value = False
     term = Terminal(13, create=True)
     term.current = 0
     term.write(3, force=True)
     self.assertEqual(len(print_patch.mock_calls), 2)
     self.assertEqual(term.current, 1)
Пример #2
0
 def test__write_Should_CallExpected_When_Notty(self, print_patch, stderr_patch, *patches):
     stderr_patch.isatty.return_value = False
     term = Terminal(13, create=True)
     term.current = 0
     term.write(3)
     print_patch.assert_not_called()
     self.assertEqual(term.current, 0)
Пример #3
0
 def test__move_up_Should_ReturnExpected_When_Called(self, up_patch, *patches):
     term = Terminal(13, create=False)
     term.current = 12
     result = term.move_up(7)
     self.assertEqual(result, up_patch.return_value)
     self.assertEqual(term.current, 7)
Пример #4
0
 def test__get_move_char_Should_ReturnExpected_When_NotMoving(self, move_down_patch, *patches):
     term = Terminal(13, create=False)
     term.current = 2
     result = term.get_move_char(2)
     self.assertEqual(result, '')
Пример #5
0
 def test__get_move_char_Should_ReturnExpected_When_MovingUp(self, move_up_patch, *patches):
     move_up_patch.return_value = Mock(), Mock()
     term = Terminal(13, create=False)
     term.current = 12
     result = term.get_move_char(7)
     self.assertEqual(result, move_up_patch.return_value)
Пример #6
0
 def test__write_lines_Should_CallExpected_When_AddDuration(self, write_patch, *patches):
     trmnl = Terminal(3, durations={'0': 'd1', '1': 'd2', '2': 'd3'})
     trmnl.current = 0
     trmnl.write_lines(add_duration=True)
     self.assertEqual(len(write_patch.mock_calls), 3)