Skip to content

Commit d2d7583

Browse files
gpsheadClaude
and
Claude
committed
Fix traceback_timestamps tests for cross-platform line endings
Use regex assertions with multi-line mode to match end of lines instead of literal newline characters. This allows the tests to pass on Windows which uses \r\n line endings instead of Unix \n line endings. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent a55c3b1 commit d2d7583

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Lib/test/test_traceback_timestamps.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ def test_strip_exc_timestamps_function(self):
230230
# Verify original strings have timestamps and stripped ones don't
231231
self.assertIn("ZeroDivisionError: division by zero <@", output)
232232
self.assertNotIn("ZeroDivisionError: division by zero\n", output)
233-
self.assertIn("ZeroDivisionError: division by zero\n", stripped_output)
234-
self.assertIn("FakeError: not an exception\n", stripped_output)
233+
self.assertRegex(stripped_output, r"(?m)ZeroDivisionError: division by zero$")
234+
self.assertRegex(stripped_output, r"(?m)FakeError: not an exception$")
235235

236236
@force_not_colorized
237237
def test_strip_exc_timestamps_with_disabled_timestamps(self):
@@ -249,10 +249,10 @@ def test_strip_exc_timestamps_with_disabled_timestamps(self):
249249
stripped_output = result.out.decode() + result.err.decode(errors='ignore')
250250

251251
# All strings should be unchanged by the strip function
252-
self.assertIn("ZeroDivisionError: division by zero\n", stripped_output)
252+
self.assertRegex(stripped_output, r"(?m)ZeroDivisionError: division by zero$")
253253
# it fits the pattern but traceback timestamps were disabled to strip_exc_timestamps does nothing.
254-
self.assertIn(
255-
"FakeError: not an exception <@1234567890.123456>\n", stripped_output
254+
self.assertRegex(
255+
stripped_output, r"(?m)FakeError: not an exception <@1234567890.123456>$"
256256
)
257257

258258
def test_timestamp_regex_pattern(self):

0 commit comments

Comments
 (0)