From 5430ef4f2c2b0b0047e1a67bb1e397ff2820e445 Mon Sep 17 00:00:00 2001 From: Amethyst Reese Date: Fri, 19 Apr 2024 13:27:19 -0700 Subject: [PATCH] Update [ghstack-poisoned] --- src/fixit/tests/rule.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/fixit/tests/rule.py b/src/fixit/tests/rule.py index 1e7c887e..c8a79d57 100644 --- a/src/fixit/tests/rule.py +++ b/src/fixit/tests/rule.py @@ -4,7 +4,7 @@ # LICENSE file in the root directory of this source tree. from pathlib import Path -from textwrap import dedent +from textwrap import dedent, indent from unittest import TestCase from unittest.mock import MagicMock @@ -282,7 +282,7 @@ class Foo(object): ): idx += 1 content = dedent(code).encode("utf-8") - with self.subTest(f"code {idx}"): + with self.subTest(f"test case {idx}"): runner = LintRunner(Path("fake.py"), content) violations = list( runner.collect_violations([ExerciseReportRule()], Config()) @@ -308,5 +308,13 @@ class Foo(object): violations.pop(0) self.assertEqual( - len(violations), 0, "Unexpected lint errors reported" + len(violations), + 0, + ( + f"Unexpected lint errors reported:\n{indent(dedent(code), ' ')}\n" + + "\n".join( + f":{v.range.start.line}:{v.range.start.column} {v.rule_name}: {v.message}" + for v in violations + ) + ), )