Skip to content

Commit

Permalink
gh-104057: Fix direct invocation of test_super (#104064)
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
  • Loading branch information
Eclips4 authored and pablogsal committed May 1, 2023
1 parent 80b7148 commit ace23be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions Lib/test/test_fstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,11 +561,12 @@ def test_mismatched_parens(self):
])
self.assertRaises(SyntaxError, eval, "f'{" + "("*500 + "}'")

@unittest.skipIf(support.is_wasi, "exhausts limited stack on WASI")
def test_fstring_nested_too_deeply(self):
self.assertAllRaise(SyntaxError,
"f-string: expressions nested too deeply",
['f"{1+2:{1+2:{1+1:{1}}}}"'])

def create_nested_fstring(n):
if n == 0:
return "1+1"
Expand All @@ -575,13 +576,13 @@ def create_nested_fstring(n):
self.assertAllRaise(SyntaxError,
"too many nested f-strings",
[create_nested_fstring(160)])

def test_syntax_error_in_nested_fstring(self):
# See gh-104016 for more information on this crash
self.assertAllRaise(SyntaxError,
"invalid syntax",
['f"{1 1:' + ('{f"1:' * 199)])

def test_double_braces(self):
self.assertEqual(f'{{', '{')
self.assertEqual(f'a{{', 'a{')
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_super.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ class C:
def method(self):
return super().msg

with patch("test.test_super.super", MySuper) as m:
with patch(f"{__name__}.super", MySuper) as m:
self.assertEqual(C().method(), "super super")

def test_shadowed_dynamic_two_arg(self):
Expand All @@ -373,7 +373,7 @@ class C:
def method(self):
return super(1, 2).msg

with patch("test.test_super.super", MySuper) as m:
with patch(f"{__name__}.super", MySuper) as m:
self.assertEqual(C().method(), "super super")
self.assertEqual(call_args, [(1, 2)])

Expand Down

0 comments on commit ace23be

Please sign in to comment.