Ejemplo n.º 1
0
    def test_single_line(self):
        expected = "Hello World\n"
        line = make_string(expected)

        line_matcher = LineMatcher()
        actual = line_matcher.readline(line, time.time())
        self.assertEqual(expected, actual)
Ejemplo n.º 2
0
    def test_single_line_partial_too_long(self):
        expected = "Hello World"
        line = make_string(expected + " How are you today")

        line_matcher = LineMatcher(max_line_length=11)
        current_time = time.time()
        actual = line_matcher.readline(line, current_time)
        self.assertEqual(expected, actual)
Ejemplo n.º 3
0
    def test_single_line_partial_timeout(self):
        expected = "Hello World"
        line = make_string(expected)

        line_matcher = LineMatcher(line_completion_wait_time=5)
        current_time = time.time() - 6
        actual = line_matcher.readline(line, current_time)
        self.assertEqual('', actual)

        actual = line_matcher.readline(line, time.time())
        self.assertEqual(expected, actual)
Ejemplo n.º 4
0
    def test_single_line_partial(self):
        expected = "Hello World"
        line = make_string(expected)

        line_matcher = LineMatcher()
        actual = line_matcher.readline(line, time.time())
        self.assertEqual('', actual)

        line = append_string(line, "\n")

        actual = line_matcher.readline(line, time.time())
        self.assertEqual(expected + "\n", actual)