Skip to content

Commit

Permalink
Use consistent quote style
Browse files Browse the repository at this point in the history
  • Loading branch information
dflook committed Oct 11, 2024
1 parent 9a32a28 commit 02cc5ae
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/python_minifier/f_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def _get_quote(self, c):
elif c != quote:
return quote

raise ValueError('Couldn\'t find a quote')
raise ValueError("Couldn't find a quote")

def _literals(self):
l = ''
Expand Down Expand Up @@ -397,7 +397,7 @@ def _get_quote(self, c):
elif chr(c) != quote:
return quote

raise ValueError('Couldn\'t find a quote')
raise ValueError("Couldn't find a quote")

def _literals(self):
l = ''
Expand Down
2 changes: 1 addition & 1 deletion test/test_comprehension_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

def test_listcomp_regression_2_7():
if sys.version_info >= (3, 0):
pytest.skip('ListComp doesn\'t create a new namespace in python < 3.0')
pytest.skip("ListComp doesn't create a new namespace in python < 3.0")

source = '''
def f(pa):
Expand Down
4 changes: 2 additions & 2 deletions test/test_decorator_expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_pep():
if sys.version_info < (3, 9):
pytest.skip('Decorator expression not allowed in python <3.9')

source = """
source = '''
buttons = [QPushButton(f'Button {i}') for i in range(10)]
# Do stuff with the list of buttons...
Expand Down Expand Up @@ -58,7 +58,7 @@ def c(): pass
]))[0]
def c(): pass
"""
'''

expected_ast = ast.parse(source)
actual_ast = unparse(expected_ast)
Expand Down
4 changes: 2 additions & 2 deletions test/test_fstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ def test_pep0701():
statement = 'f"{f"{f"{f"{f"{f"{1+1}"}"}"}"}"}"'
assert unparse(ast.parse(statement)) == statement

statement = """
statement = '''
f"This is the playlist: {", ".join([
'Take me back to Eden', # My, my, those eyes like fire
'Alkaline', # Not acid nor alkaline
'Ascensionism' # Take to the broken skies at last
])}"
"""
'''
assert unparse(ast.parse(statement)) == 'f"This is the playlist: {", ".join(["Take me back to Eden","Alkaline","Ascensionism"])}"'

# statement = '''print(f"This is the playlist: {"\N{BLACK HEART SUIT}".join(songs)}")'''
Expand Down
4 changes: 2 additions & 2 deletions test/test_remove_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def b(): 0'''


@pytest.mark.parametrize(
"condition", [
'condition', [
'__debug__',
'__debug__ is True',
'__debug__ is not False',
Expand Down Expand Up @@ -139,7 +139,7 @@ def test_remove_truthy_debug(condition):


@pytest.mark.parametrize(
"condition", [
'condition', [
'not __debug__',
'__debug__ is False',
'__debug__ is not True',
Expand Down
1 change: 0 additions & 1 deletion test/test_type_param_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from python_minifier import unparse
from python_minifier.ast_compare import compare_ast


# There are bizarrely few examples of this, some in the PEP are even syntax errors

def test_pep696():
Expand Down
2 changes: 1 addition & 1 deletion xtest/test_unparse_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from python_minifier import minify, unparse

warnings.filterwarnings("ignore")
warnings.filterwarnings('ignore')


def gather_files():
Expand Down

0 comments on commit 02cc5ae

Please sign in to comment.