8000 Run pyupgrade by methane · Pull Request #1118 · PyMySQL/PyMySQL · GitHub
[go: up one dir, main page]

Skip to content

Run pyupgrade #1118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
pyupgrade pymysql/tests
  • Loading branch information
methane committed May 24, 2023
commit 988e03136bfea6393e07e147621729ebee4adac6
4 changes: 2 additions & 2 deletions pymysql/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def safe_create_table(self, connection, tablename, ddl, cleanup=True):

with warnings.catch_warnings():
warnings.simplefilter("ignore")
cursor.execute("drop table if exists `%s`" % (tablename,))
cursor.execute(f"drop table if exists `{tablename}`")
cursor.execute(ddl)
cursor.close()
if cleanup:
Expand All @@ -108,5 +108,5 @@ def drop_table(self, connection, tablename):
cursor = connection.cursor()
with warnings.catch_warnings():
warnings.simplefilter("ignore")
cursor.execute("drop table if exists `%s`" % (tablename,))
cursor.execute(f"drop table if exists `{tablename}`")
cursor.close()
4 changes: 2 additions & 2 deletions pymysql/tests/test_DictCursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class TestDictCursor(base.PyMySQLTestCase):
cursor_type = pymysql.cursors.DictCursor

def setUp(self):
super(TestDictCursor, self).setUp()
super().setUp()
self.conn = conn = self.connect()
c = conn.cursor(self.cursor_type)

Expand All @@ -36,7 +36,7 @@ def setUp(self):
def tearDown(self):
c = self.conn.cursor()
c.execute("drop table dictcursor")
super(TestDictCursor, self).tearDown()
super().tearDown()

def _ensure_cursor_expired(self, cursor):
pass
Expand Down
2 changes: 1 addition & 1 deletion pymysql/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ class TestBulkInserts(base.PyMySQLTestCase):
cursor_type = pymysql.cursors.DictCursor

def setUp(self):
super(TestBulkInserts, self).setUp()
super().setUp()
self.conn = conn = self.connect()

# create a table and some data to query
Expand Down
4 changes: 2 additions & 2 deletions pymysql/tests/test_connection.py 8000
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, c, user, db, auth=None, authdata=None, password=None):
# already exists - TODO need to check the same plugin applies
self._created = False
try:
c.execute("GRANT SELECT ON %s.* TO %s" % (db, user))
c.execute(f"GRANT SELECT ON {db}.* TO {user}")
self._grant = True
except pymysql.err.InternalError:
self._grant = False
Expand All @@ -38,7 +38,7 @@ def __enter__(self):

def __exit__(self, exc_type, exc_value, traceback):
if self._grant:
self._c.execute("REVOKE SELECT ON %s.* FROM %s" % (self._db, self._user))
self._c.execute(f"REVOKE SELECT ON {self._db}.* FROM {self._user}")
if self._created:
self._c.execute("DROP USER %s" % self._user)

Expand Down
2 changes: 1 addition & 1 deletion pymysql/tests/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class CursorTest(base.PyMySQLTestCase):
def setUp(self):
super(CursorTest, self).setUp()
super().setUp()

conn = self.connect()
self.safe_create_table(
Expand Down
4 changes: 2 additions & 2 deletions pymysql/tests/test_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ def test_issue_175(self):
conn = self.connect()
cur = conn.cursor()
for length in (200, 300):
columns = ", ".join("c{0} integer".format(i) for i in range(length))
sql = "create table test_field_count ({0})".format(columns)
columns = ", ".join(f"c{i} integer" for i in range(length))
sql = f"create table test_field_count ({columns})"
try:
cur.execute(sql)
cur.execute("select * from test_field_count")
Expand Down
0