Skip to content

Commit 7a95b33

Browse files
committed
Fix test_ast_expr for Python 3.13
1 parent 5022f1f commit 7a95b33

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/test_prettier.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ class User(SQLAlchemyBase):
486486

487487

488488
@pytest.mark.skipif(sys.version_info < (3, 9), reason='no indent on older versions')
489+
@pytest.mark.skipif(sys.version_info >= (3, 13), reason='show_empty=False on newer versions')
489490
def test_ast_expr():
490491
assert pformat(ast.parse('print(1, 2, round(3))', mode='eval')) == (
491492
"Expression("
@@ -503,6 +504,22 @@ def test_ast_expr():
503504
)
504505

505506

507+
@pytest.mark.skipif(sys.version_info < (3, 13), reason='no show_empty on older versions')
508+
def test_ast_expr_show_empty():
509+
assert pformat(ast.parse('print(1, 2, round(3))', mode='eval')) == (
510+
"Expression("
511+
"\n body=Call("
512+
"\n func=Name(id='print', ctx=Load()),"
513+
"\n args=["
514+
"\n Constant(value=1),"
515+
"\n Constant(value=2),"
516+
"\n Call("
517+
"\n func=Name(id='round', ctx=Load()),"
518+
"\n args=["
519+
"\n Constant(value=3)])]))"
520+
)
521+
522+
506523
@pytest.mark.skipif(sys.version_info < (3, 9), reason='no indent on older versions')
507524
def test_ast_module():
508525
assert pformat(ast.parse('print(1, 2, round(3))')).startswith('Module(\n body=[')

0 commit comments

Comments
 (0)