Skip to content

Commit

Permalink
using ylib2to3 means we can test <=py311 on any python version suppor…
Browse files Browse the repository at this point in the history
…ted by YAPF (#1162)

Since we're using ylib2to3 instead of lib2to3 this means we can test <=py311
on any python version supported by YAPF.

[] remove language in Readme that says YAPF must run as the same version
of Python as the code you're formatting.
  • Loading branch information
Spitfire1900 authored Oct 10, 2023
1 parent 818ac2e commit ed6f56b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.7", "3.8", "3.11"] # no particular need for 3.9 or 3.10
python-version: ["3.7", "3.11", "3.12"] # no particular need for 3.9 or 3.10
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
Expand Down
6 changes: 0 additions & 6 deletions yapftests/reformatter_basic_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@

from yapftests import yapf_test_helper

PY38 = sys.version_info[0] >= 3 and sys.version_info[1] >= 8
PY310 = sys.version_info[0] >= 3 and sys.version_info[1] >= 10


class BasicReformatterTest(yapf_test_helper.YAPFTest):

Expand Down Expand Up @@ -3217,7 +3214,6 @@ def testForceMultilineDict_False(self):
finally:
style.SetGlobalStyle(style.CreateYapfStyle())

@unittest.skipUnless(PY38, 'Requires Python 3.8')
def testWalrus(self):
unformatted_code = textwrap.dedent("""\
if (x := len([1]*1000)>100):
Expand All @@ -3230,7 +3226,6 @@ def testWalrus(self):
llines = yapf_test_helper.ParseAndUnwrap(unformatted_code)
self.assertCodeEqual(expected, reformatter.Reformat(llines))

@unittest.skipUnless(PY310, 'Requires Python 3.10')
def testStructuredPatternMatching(self):
unformatted_code = textwrap.dedent("""\
match command.split():
Expand All @@ -3249,7 +3244,6 @@ def testStructuredPatternMatching(self):
llines = yapf_test_helper.ParseAndUnwrap(unformatted_code)
self.assertCodeEqual(expected, reformatter.Reformat(llines))

@unittest.skipUnless(PY310, 'Requires Python 3.10')
def testParenthesizedContextManagers(self):
unformatted_code = textwrap.dedent("""\
with (cert_authority.cert_pem.tempfile() as ca_temp_path, patch.object(os, 'environ', os.environ | {'REQUESTS_CA_BUNDLE': ca_temp_path}),):
Expand Down

0 comments on commit ed6f56b

Please sign in to comment.