mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-16 12:27:03 +08:00
black 20.8b1
This commit is contained in:
@ -131,7 +131,11 @@ def Time_or_None(s):
|
||||
|
||||
def Date_or_None(s):
|
||||
try:
|
||||
return date(int(s[:4]), int(s[5:7]), int(s[8:10]),) # year # month # day
|
||||
return date(
|
||||
int(s[:4]),
|
||||
int(s[5:7]),
|
||||
int(s[8:10]),
|
||||
) # year # month # day
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
|
@ -68,12 +68,12 @@ class DatabaseTest(unittest.TestCase):
|
||||
|
||||
def create_table(self, columndefs):
|
||||
|
||||
""" Create a table using a list of column definitions given in
|
||||
columndefs.
|
||||
"""Create a table using a list of column definitions given in
|
||||
columndefs.
|
||||
|
||||
generator must be a function taking arguments (row_number,
|
||||
col_number) returning a suitable data object for insertion
|
||||
into the table.
|
||||
generator must be a function taking arguments (row_number,
|
||||
col_number) returning a suitable data object for insertion
|
||||
into the table.
|
||||
|
||||
"""
|
||||
self.table = self.new_table_name()
|
||||
|
@ -5,7 +5,10 @@ from os import environ, path
|
||||
tests_path = path.dirname(__file__)
|
||||
conf_file = environ.get("TESTDB", "default.cnf")
|
||||
conf_path = path.join(tests_path, conf_file)
|
||||
connect_kwargs = dict(read_default_file=conf_path, read_default_group="MySQLdb-tests",)
|
||||
connect_kwargs = dict(
|
||||
read_default_file=conf_path,
|
||||
read_default_group="MySQLdb-tests",
|
||||
)
|
||||
|
||||
|
||||
def connection_kwargs(kwargs):
|
||||
|
@ -66,25 +66,25 @@ import time
|
||||
|
||||
|
||||
class DatabaseAPI20Test(unittest.TestCase):
|
||||
""" Test a database self.driver for DB API 2.0 compatibility.
|
||||
This implementation tests Gadfly, but the TestCase
|
||||
is structured so that other self.drivers can subclass this
|
||||
test case to ensure compiliance with the DB-API. It is
|
||||
expected that this TestCase may be expanded in the future
|
||||
if ambiguities or edge conditions are discovered.
|
||||
"""Test a database self.driver for DB API 2.0 compatibility.
|
||||
This implementation tests Gadfly, but the TestCase
|
||||
is structured so that other self.drivers can subclass this
|
||||
test case to ensure compiliance with the DB-API. It is
|
||||
expected that this TestCase may be expanded in the future
|
||||
if ambiguities or edge conditions are discovered.
|
||||
|
||||
The 'Optional Extensions' are not yet being tested.
|
||||
The 'Optional Extensions' are not yet being tested.
|
||||
|
||||
self.drivers should subclass this test, overriding setUp, tearDown,
|
||||
self.driver, connect_args and connect_kw_args. Class specification
|
||||
should be as follows:
|
||||
self.drivers should subclass this test, overriding setUp, tearDown,
|
||||
self.driver, connect_args and connect_kw_args. Class specification
|
||||
should be as follows:
|
||||
|
||||
import dbapi20
|
||||
class mytest(dbapi20.DatabaseAPI20Test):
|
||||
[...]
|
||||
import dbapi20
|
||||
class mytest(dbapi20.DatabaseAPI20Test):
|
||||
[...]
|
||||
|
||||
Don't 'import DatabaseAPI20Test from dbapi20', or you will
|
||||
confuse the unit tester - just 'import dbapi20'.
|
||||
Don't 'import DatabaseAPI20Test from dbapi20', or you will
|
||||
confuse the unit tester - just 'import dbapi20'.
|
||||
"""
|
||||
|
||||
# The self.driver module. This should be the module where the 'connect'
|
||||
@ -110,15 +110,15 @@ class DatabaseAPI20Test(unittest.TestCase):
|
||||
cursor.execute(self.ddl2)
|
||||
|
||||
def setUp(self):
|
||||
""" self.drivers should override this method to perform required setup
|
||||
if any is necessary, such as creating the database.
|
||||
"""self.drivers should override this method to perform required setup
|
||||
if any is necessary, such as creating the database.
|
||||
"""
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
""" self.drivers should override this method to perform required cleanup
|
||||
if any is necessary, such as deleting the test database.
|
||||
The default drops the tables that may be created.
|
||||
"""self.drivers should override this method to perform required cleanup
|
||||
if any is necessary, such as deleting the test database.
|
||||
The default drops the tables that may be created.
|
||||
"""
|
||||
con = self._connect()
|
||||
try:
|
||||
@ -521,8 +521,8 @@ class DatabaseAPI20Test(unittest.TestCase):
|
||||
]
|
||||
|
||||
def _populate(self):
|
||||
""" Return a list of sql commands to setup the DB for the fetch
|
||||
tests.
|
||||
"""Return a list of sql commands to setup the DB for the fetch
|
||||
tests.
|
||||
"""
|
||||
populate = [
|
||||
"insert into {}booze values ('{}')".format(self.table_prefix, s)
|
||||
@ -710,9 +710,9 @@ class DatabaseAPI20Test(unittest.TestCase):
|
||||
con.close()
|
||||
|
||||
def help_nextset_setUp(self, cur):
|
||||
""" Should create a procedure called deleteme
|
||||
that returns two result sets, first the
|
||||
number of rows in booze then "name from booze"
|
||||
"""Should create a procedure called deleteme
|
||||
that returns two result sets, first the
|
||||
number of rows in booze then "name from booze"
|
||||
"""
|
||||
raise NotImplementedError("Helper not implemented")
|
||||
# sql="""
|
||||
|
@ -161,9 +161,10 @@ class test_MySQLdb(dbapi20.DatabaseAPI20Test):
|
||||
pass # performed in test_MySQL_capabilities
|
||||
|
||||
def help_nextset_setUp(self, cur):
|
||||
""" Should create a procedure called deleteme
|
||||
that returns two result sets, first the
|
||||
number of rows in booze then "name from booze"
|
||||
"""
|
||||
Should create a procedure called deleteme
|
||||
that returns two result sets, first the
|
||||
number of rows in booze then "name from booze"
|
||||
"""
|
||||
sql = """
|
||||
create procedure deleteme()
|
||||
|
Reference in New Issue
Block a user