summaryrefslogtreecommitdiff
path: root/tests/test_format.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2020-05-24 06:44:09 -0700
committerJon Dufresne <jon.dufresne@gmail.com>2020-08-31 17:27:38 -0700
commit3e3892f939031d58d98275ce8a237689225d299a (patch)
tree93b64d7fd8aa1cc19335db11c915dfc59376eae9 /tests/test_format.py
parent28a2acdd9b307c95d2111f1f831b1a5afc634691 (diff)
downloadsqlparse-3e3892f939031d58d98275ce8a237689225d299a.tar.gz
Remove support for end-of-life Pythons
Python 2.7 and 3.4 are end-of-life. They are no longer receiving bug fixes, including for security issues. Python 2.7 went EOL on 2020-01-01 and 3.4 on 2019-03-18. For additional details on support Python versions, see: Supported: https://devguide.python.org/#status-of-python-branches EOL: https://devguide.python.org/devcycle/#end-of-life-branches Removing support for EOL Pythons will reduce testing and maintenance resources while allowing the library to move towards modern Python 3. Using pypinfo, we can show the PyPI download statistics, showing less than 10% of users are using Python 2.7. | python_version | percent | download_count | | -------------- | ------: | -------------: | | 3.7 | 45.36% | 3,056,010 | | 3.6 | 26.46% | 1,782,778 | | 3.8 | 12.22% | 823,213 | | 2.7 | 9.97% | 671,459 | | 3.5 | 5.86% | 394,846 | | 3.4 | 0.10% | 6,700 | | 3.9 | 0.03% | 2,346 | | 2.6 | 0.00% | 57 | | 3.3 | 0.00% | 21 | | 3.10 | 0.00% | 6 | | Total | | 6,737,436 | Library users who continue to use Python 2.7 will still be able to install previous versions of sqlparse. Compatibility shims have been dropped, simplifying the code. Using pyupgrade, the codebase has been updated to take advantage of modern syntax <https://github.com/asottile/pyupgrade>. The wheel is no longer marked as "universal" as it is now Python 3 only.
Diffstat (limited to 'tests/test_format.py')
-rw-r--r--tests/test_format.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/tests/test_format.py b/tests/test_format.py
index 811e083..20390ff 100644
--- a/tests/test_format.py
+++ b/tests/test_format.py
@@ -1,12 +1,10 @@
-# -*- coding: utf-8 -*-
-
import pytest
import sqlparse
from sqlparse.exceptions import SQLParseError
-class TestFormat(object):
+class TestFormat:
def test_keywordcase(self):
sql = 'select * from bar; -- select foo\n'
res = sqlparse.format(sql, keyword_case='upper')
@@ -123,7 +121,7 @@ class TestFormat(object):
== "SELECT some_column LIKE 'value\\\\\\'\r' WHERE id = 1\n")
-class TestFormatReindentAligned(object):
+class TestFormatReindentAligned:
@staticmethod
def formatter(sql):
return sqlparse.format(sql, reindent_aligned=True)
@@ -294,7 +292,7 @@ class TestFormatReindentAligned(object):
' from table'])
-class TestSpacesAroundOperators(object):
+class TestSpacesAroundOperators:
@staticmethod
def formatter(sql):
return sqlparse.format(sql, use_space_around_operators=True)
@@ -321,7 +319,7 @@ class TestSpacesAroundOperators(object):
assert self.formatter(sql) == 'select a * b - c from table'
-class TestFormatReindent(object):
+class TestFormatReindent:
def test_option(self):
with pytest.raises(SQLParseError):
sqlparse.format('foo', reindent=2)
@@ -598,7 +596,7 @@ class TestFormatReindent(object):
' , (5, 6)'])
-class TestOutputFormat(object):
+class TestOutputFormat:
def test_python(self):
sql = 'select * from foo;'
f = lambda sql: sqlparse.format(sql, output_format='python')
@@ -663,7 +661,7 @@ def test_format_column_ordering():
def test_truncate_strings():
- sql = "update foo set value = '{0}';".format('x' * 1000)
+ sql = "update foo set value = '{}';".format('x' * 1000)
formatted = sqlparse.format(sql, truncate_strings=10)
assert formatted == "update foo set value = 'xxxxxxxxxx[...]';"
formatted = sqlparse.format(sql, truncate_strings=3, truncate_char='YYY')