Esempio n. 1
0
 def test_find_furthest_new_line_with_no_new_line_in_non_empty_byte_string(
     self,
 ):
     """Expect return value of -1 when non-empty bytestrings that don't contain new line is passed in."""
     test_string = b"SomeRandomCharacters"
     r = _find_furthest_new_line(test_string)
     self.assertEqual(r, -1)
Esempio n. 2
0
 def test_find_furthest_new_line_with_no_new_line_in_empty_byte_string(
     self,
 ):
     """Expect return value of -1 when empty bytestring is passed in."""
     test_string = b""
     r = _find_furthest_new_line(test_string)
     self.assertEqual(r, -1)
 def test_find_furthest_new_line_with_bytestring_with_new_line_in_the_middle_and_end(
         self):
     """Expect return value of the last index of the test_string because the new line is at the end."""
     base_string = b"SomeRandomCharacters"
     for n in new_lines_bytes:
         test_string = base_string + n + base_string + n
         expected_value = len(test_string) - 1
         r = _find_furthest_new_line(test_string)
         self.assertEqual(r,
                          expected_value,
                          msg="Test with {0} as new line".format(repr(n)))
 def test_find_furthest_new_line_with_bytestring_with_new_line_in_the_middle(
         self):
     """Expect return value pointing to the middle of the test string where the newline is at."""
     base_string = b"SomeRandomCharacters"
     for n in new_lines_bytes:
         test_string = base_string + n + base_string
         expected_value = len(base_string) + len(n) - 1
         r = _find_furthest_new_line(test_string)
         self.assertEqual(r,
                          expected_value,
                          msg="Test with {0} as new line".format(repr(n)))