| Total Complexity | 6 | 
| Total Lines | 51 | 
| Duplicated Lines | 0 % | 
| 1 | import sys | ||
| 10 | class UnescapedStripTest(StringProcessingTestBase): | ||
| 11 |     test_strings2 = ("hello\\", | ||
| 12 | "te\\st\\\\", | ||
| 13 | "A\\ ", | ||
| 14 | "A\\ ", | ||
| 15 | " A \\ \\ ", | ||
| 16 | " \\ A \\ ", | ||
| 17 | " \\\\ A", | ||
| 18 | " \\\\\\\\\\ ", | ||
| 19 | " \\\\\\\\ ") | ||
| 20 | |||
| 21 | def test_rstrip(self): | ||
| 22 |         expected_results = ("hello\\", | ||
| 23 | "te\\st\\\\", | ||
| 24 | "A\\ ", | ||
| 25 | "A\\ ", | ||
| 26 | " A \\ \\ ", | ||
| 27 | " \\ A \\ ", | ||
| 28 | " \\\\ A", | ||
| 29 | " \\\\\\\\\\ ", | ||
| 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_basic(self): | ||
| 39 |         expected_results = ("hello\\", | ||
| 40 | "te\\st\\\\", | ||
| 41 | "A\\ ", | ||
| 42 | "A\\ ", | ||
| 43 | "A \\ \\ ", | ||
| 44 | "\\ A \\ ", | ||
| 45 | "\\\\ A", | ||
| 46 | "\\\\\\\\\\ ", | ||
| 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 | self.assertResultsEqual( | ||
| 58 | unescaped_strip, | ||
| 59 |             {(test_string,): test_string | ||
| 60 | for test_string in self.test_strings}) | ||
| 61 | |||
| 65 |