mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 12:33:40 +00:00
tests: Remove compatibility code for Python < 3.5.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
bca5564c1e
commit
4e645c8ff9
@@ -48,25 +48,15 @@ class TestRuleList(TestCase):
|
||||
for rule in self.all_rules:
|
||||
pattern = rule["pattern"]
|
||||
for line in rule.get("good_lines", []):
|
||||
# create=True is superfluous when mocking built-ins in Python >= 3.5
|
||||
with patch(
|
||||
"builtins.open",
|
||||
return_value=StringIO(line + "\n\n"),
|
||||
create=True,
|
||||
autospec=True,
|
||||
):
|
||||
with patch("builtins.open", return_value=StringIO(line + "\n\n"), autospec=True):
|
||||
self.assertFalse(
|
||||
RuleList([], [rule]).custom_check_file("foo.bar", "baz", ""),
|
||||
f"The pattern '{pattern}' matched the line '{line}' while it shouldn't.",
|
||||
)
|
||||
|
||||
for line in rule.get("bad_lines", []):
|
||||
# create=True is superfluous when mocking built-ins in Python >= 3.5
|
||||
with patch(
|
||||
"builtins.open",
|
||||
return_value=StringIO(line + "\n\n"),
|
||||
create=True,
|
||||
autospec=True,
|
||||
"builtins.open", return_value=StringIO(line + "\n\n"), autospec=True
|
||||
), patch("builtins.print"):
|
||||
filename = list(rule.get("include_only", {"foo.bar"}))[0]
|
||||
self.assertTrue(
|
||||
|
||||
Reference in New Issue
Block a user