| Total Complexity | 6 | 
| Total Lines | 52 | 
| Duplicated Lines | 0 % | 
| 1 | import sys | ||
| 10 | class UnescapedStripTest(StringProcessingTestBase): | ||
| 11 |     test_strings2 = ("hello\\", | ||
| 12 | "te\\st\\\\", | ||
| 13 | r"A\ ", | ||
| 14 | r"A\ ", | ||
| 15 | r" A \ \ ", | ||
| 16 | r" \ A \ ", | ||
| 17 | r" \\ A", | ||
| 18 | r" \\\\\ ", | ||
| 19 | r" \\\\ ") | ||
| 20 | |||
| 21 | def test_rstrip(self): | ||
| 22 |         expected_results = ("hello\\", | ||
| 23 | "te\\st\\\\", | ||
| 24 | r"A\ ", | ||
| 25 | r"A\ ", | ||
| 26 | r" A \ \ ", | ||
| 27 | r" \ A \ ", | ||
| 28 | r" \\ A", | ||
| 29 | r" \\\\\ ", | ||
| 30 | " \\\\\\\\") | ||
| 31 | |||
| 32 | self.assertResultsEqual( | ||
| 33 | unescaped_rstrip, | ||
| 34 |             {(test_string,): result | ||
| 35 | for test_string, result in zip(self.test_strings2, | ||
| 36 | expected_results)}) | ||
| 37 | |||
| 38 | def test_strip(self): | ||
| 39 |         expected_results = ("hello\\", | ||
| 40 | "te\\st\\\\", | ||
| 41 | r"A\ ", | ||
| 42 | r"A\ ", | ||
| 43 | r"A \ \ ", | ||
| 44 | r"\ A \ ", | ||
| 45 | r"\\ A", | ||
| 46 | r"\\\\\ ", | ||
| 47 | "\\\\\\\\") | ||
| 48 | |||
| 49 | self.assertResultsEqual( | ||
| 50 | unescaped_strip, | ||
| 51 |             {(test_string,): result | ||
| 52 | for test_string, result in zip(self.test_strings2, | ||
| 53 | expected_results)}) | ||
| 54 | |||
| 55 | def test_no_whitespaced_strings(self): | ||
| 56 | # When no leading or trailing whitespaces exist, nothing should happen. | ||
| 57 | # By the way: self.test_strings comes from the base class. | ||
| 58 | self.assertResultsEqual( | ||
| 59 | unescaped_strip, | ||
| 60 |             {(test_string,): test_string | ||
| 61 | for test_string in self.test_strings}) | ||
| 62 | |||
| 66 |