Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.15']

runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# python devtools

[![CI](https://github.com/samuelcolvin/python-devtools/workflows/CI/badge.svg?event=push)](https://github.com/samuelcolvin/python-devtools/actions?query=event%3Apush+branch%3Amain+workflow%3ACI)
[![CI](https://img.shields.io/github/actions/workflow/status/samuelcolvin/python-devtools/ci.yml?branch=main&logo=github&label=CI)](https://github.com/samuelcolvin/python-devtools/actions?query=event%3Apush+branch%3Amain+workflow%3ACI)
[![Coverage](https://coverage-badge.samuelcolvin.workers.dev/samuelcolvin/python-devtools.svg)](https://coverage-badge.samuelcolvin.workers.dev/redirect/samuelcolvin/python-devtools)
[![pypi](https://img.shields.io/pypi/v/devtools.svg)](https://pypi.python.org/pypi/devtools)
[![versions](https://img.shields.io/pypi/pyversions/devtools.svg)](https://github.com/samuelcolvin/python-devtools)
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Python devtools

[![CI](https://github.com/samuelcolvin/python-devtools/workflows/CI/badge.svg?event=push)](https://github.com/samuelcolvin/python-devtools/actions?query=event%3Apush+branch%3Amain+workflow%3ACI)
[![CI](https://img.shields.io/github/actions/workflow/status/samuelcolvin/python-devtools/ci.yml?branch=main&logo=github&label=CI)](https://github.com/samuelcolvin/python-devtools/actions?query=event%3Apush+branch%3Amain+workflow%3ACI)
[![Coverage](https://coverage-badge.samuelcolvin.workers.dev/samuelcolvin/python-devtools.svg)](https://coverage-badge.samuelcolvin.workers.dev/redirect/samuelcolvin/python-devtools)
[![pypi](https://img.shields.io/pypi/v/devtools.svg)](https://pypi.python.org/pypi/devtools)
[![versions](https://img.shields.io/pypi/pyversions/devtools.svg)](https://github.com/samuelcolvin/python-devtools)
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ classifiers = [
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3.14',
'Programming Language :: Python :: 3.15',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Internet',
'Typing :: Typed',
Expand Down
43 changes: 8 additions & 35 deletions tests/test_prettier.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import ast
import os
import string
import sys
from collections import Counter, OrderedDict
from collections.abc import Iterator
from dataclasses import dataclass
Expand Down Expand Up @@ -456,40 +455,14 @@ class User(SQLAlchemyBase):
)


@pytest.mark.skipif(sys.version_info < (3, 9), reason='no indent on older versions')
def test_ast_expr():
if sys.version_info >= (3, 13):
# ast.dump omits empty lists from 3.13 onwards
expected = (
'Expression('
'\n body=Call('
"\n func=Name(id='print', ctx=Load()),"
'\n args=['
'\n Constant(value=1),'
'\n Constant(value=2),'
'\n Call('
"\n func=Name(id='round', ctx=Load()),"
'\n args=['
'\n Constant(value=3)])]))'
)
else:
expected = (
'Expression('
'\n body=Call('
"\n func=Name(id='print', ctx=Load()),"
'\n args=['
'\n Constant(value=1),'
'\n Constant(value=2),'
'\n Call('
"\n func=Name(id='round', ctx=Load()),"
'\n args=['
'\n Constant(value=3)],'
'\n keywords=[])],'
'\n keywords=[]))'
)
assert pformat(ast.parse('print(1, 2, round(3))', mode='eval')) == expected


@pytest.mark.skipif(sys.version_info < (3, 9), reason='no indent on older versions')
node = ast.parse('print(1, 2, round(3))', mode='eval')
v = pformat(node)
# exactly which fields ast.dump omits changes between python versions, so compare to its own output
assert v == ast.dump(node, indent=4)
assert v.startswith('Expression(\n body=Call(\n func=Name(')
assert '\n Constant(value=3)' in v


def test_ast_module():
assert pformat(ast.parse('print(1, 2, round(3))')).startswith('Module(\n body=[')
Loading