Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pre-release' into pre-release
Browse files Browse the repository at this point in the history
  • Loading branch information
polischuks committed Feb 15, 2025
2 parents 1eba272 + b09696c commit 8c1e2fe
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions hstest/testing/unittest/expected_fail_test.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from __future__ import annotations

from inspect import cleandoc
import re
from typing import Any
from inspect import cleandoc

from hstest.stage.stage_test import StageTest

Expand All @@ -19,10 +18,9 @@ def __init__(self, args) -> None:

def normalize_error_message(self, message: str) -> str:
# Remove error pointer markers added in Python 3.11+
message = re.sub(r'\s+[~^]+\s*', ' ', message)
message = re.sub(r"\s+[~^]+\s*", " ", message)
# Normalize whitespace and line breaks
message = ' '.join(message.split())
return message
return " ".join(message.split())

def test_run_unittest(self) -> None:
if not self.contain and not self.not_contain:
Expand All @@ -48,10 +46,16 @@ def test_run_unittest(self) -> None:

for item in should_contain:
normalized_item = self.normalize_error_message(cleandoc(item))
self.assertIn(normalized_item, normalized_feedback,
f"Expected to find:\n{normalized_item}\nin:\n{normalized_feedback}")
self.assertIn(
normalized_item,
normalized_feedback,
f"Expected to find:\n{normalized_item}\nin:\n{normalized_feedback}",
)

for item in should_not_contain:
normalized_item = self.normalize_error_message(cleandoc(item))
self.assertNotIn(normalized_item, normalized_feedback,
f"Expected NOT to find:\n{normalized_item}\nin:\n{normalized_feedback}")
self.assertNotIn(
normalized_item,
normalized_feedback,
f"Expected NOT to find:\n{normalized_item}\nin:\n{normalized_feedback}",
)

0 comments on commit 8c1e2fe

Please sign in to comment.