Commit 1ac0ba0e authored by Matti Picus's avatar Matti Picus
Browse files

skip ast tests that check end_lineno and end_linepos, we will get that in 3.9

--HG--
branch : py3.8
parent 2d16797df342
Pipeline #22902 failed with stage
in 7 minutes and 31 seconds
......@@ -9,6 +9,8 @@ from textwrap import dedent
from test import support
skip_pypy_pre_39 = sys.implementation.name == 'pypy' and sys.version_info < (3, 9)
def to_tuple(t):
if t is None or isinstance(t, (str, int, complex)):
return t
......@@ -865,6 +867,7 @@ class ASTHelpers_Test(unittest.TestCase):
self.assertEqual(elif_stmt.lineno, 3)
self.assertEqual(elif_stmt.col_offset, 0)
@unittest.skipIf(skip_pypy_pre_39, "pypy does not implement 'end_lineno'")
def test_starred_expr_end_position_within_call(self):
node = ast.parse('f(*[0, 1])')
starred_expr = node.body[0].value.args[0]
......@@ -1466,6 +1469,7 @@ class ConstantTests(unittest.TestCase):
self.assertEqual(c.kind, None)
class EndPositionTests(unittest.TestCase):
"""Tests for end position of AST nodes.
......@@ -1473,10 +1477,14 @@ class EndPositionTests(unittest.TestCase):
because of how LL parsers work.
"""
def _check_end_pos(self, ast_node, end_lineno, end_col_offset):
if skip_pypy_pre_39:
return
self.assertEqual(ast_node.end_lineno, end_lineno)
self.assertEqual(ast_node.end_col_offset, end_col_offset)
def _check_content(self, source, ast_node, content):
if skip_pypy_pre_39:
return
self.assertEqual(ast.get_source_segment(source, ast_node), content)
def _parse_value(self, s):
......@@ -1750,6 +1758,7 @@ class EndPositionTests(unittest.TestCase):
self._check_content(s, fdef.body[0].value, 'yield x')
self._check_content(s, fdef.body[1].value, 'await y')
@unittest.skipIf(skip_pypy_pre_39, "pypy does not implement 'end_linepos'")
def test_source_segment_multi(self):
s_orig = dedent('''
x = (
......@@ -1764,6 +1773,7 @@ class EndPositionTests(unittest.TestCase):
binop = self._parse_value(s_orig)
self.assertEqual(ast.get_source_segment(s_orig, binop.left), s_tuple)
@unittest.skipIf(skip_pypy_pre_39, "pypy does not implement 'end_linepos'")
def test_source_segment_padded(self):
s_orig = dedent('''
class C:
......@@ -1785,6 +1795,7 @@ class EndPositionTests(unittest.TestCase):
self._check_content(s, y, 'y = 1')
self._check_content(s, z, 'z = 1')
@unittest.skipIf(skip_pypy_pre_39, "pypy does not implement 'end_linepos'")
def test_source_segment_tabs(self):
s = dedent('''
class C:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment