def test_return_all(self): io = IO(None) dr = DataReader(io) dr.lines = ["one\r\n", "two\r\n", ".\r\n", "three\r\n"] dr.EOD = 2 self.assertEqual("one\r\ntwo\r\n", dr.return_all()) self.assertEqual("three\r\n", io.recv_buffer)
def test_return_all(self): io = IO(None) dr = DataReader(io) dr.lines = [b'one\r\n', b'two\r\n', b'.\r\n', b'three\r\n'] dr.EOD = 2 self.assertEqual(b'one\r\ntwo\r\n', dr.return_all()) self.assertEqual(b'three\r\n', io.recv_buffer)
def test_return_all(self): io = IO(None) dr = DataReader(io) dr.lines = ['one\r\n', 'two\r\n', '.\r\n', 'three\r\n'] dr.EOD = 2 assert_equal('one\r\ntwo\r\n', dr.return_all()) assert_equal('three\r\n', io.recv_buffer)
def test_handle_finished_line_initial_period(self): dr = DataReader(None) dr.lines = [b'..stuff\r\n'] dr.handle_finished_line() self.assertEqual(b'.stuff\r\n', dr.lines[0])
def test_handle_finished_line_EOD(self): dr = DataReader(None) dr.lines = [b'.\r\n'] dr.handle_finished_line() self.assertEqual(0, dr.EOD)
def test_handle_finished_line_initial_period(self): dr = DataReader(None) dr.lines = ["..stuff\r\n"] dr.handle_finished_line() assert_equal(".stuff\r\n", dr.lines[0])
def test_handle_finished_line_EOD(self): dr = DataReader(None) dr.lines = [".\r\n"] dr.handle_finished_line() assert_equal(0, dr.EOD)