summaryrefslogtreecommitdiff
path: root/test/engine/test_processors.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-01-06 01:14:26 -0500
committermike bayer <mike_mp@zzzcomputing.com>2019-01-06 17:34:50 +0000
commit1e1a38e7801f410f244e4bbb44ec795ae152e04e (patch)
tree28e725c5c8188bd0cfd133d1e268dbca9b524978 /test/engine/test_processors.py
parent404e69426b05a82d905cbb3ad33adafccddb00dd (diff)
downloadsqlalchemy-1e1a38e7801f410f244e4bbb44ec795ae152e04e.tar.gz
Run black -l 79 against all source files
This is a straight reformat run using black as is, with no edits applied at all. The black run will format code consistently, however in some cases that are prevalent in SQLAlchemy code it produces too-long lines. The too-long lines will be resolved in the following commit that will resolve all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9
Diffstat (limited to 'test/engine/test_processors.py')
-rw-r--r--test/engine/test_processors.py117
1 files changed, 52 insertions, 65 deletions
diff --git a/test/engine/test_processors.py b/test/engine/test_processors.py
index 9f0055e05..8da838145 100644
--- a/test/engine/test_processors.py
+++ b/test/engine/test_processors.py
@@ -4,42 +4,28 @@ from sqlalchemy.testing import assert_raises_message, eq_
class _BooleanProcessorTest(fixtures.TestBase):
def test_int_to_bool_none(self):
- eq_(
- self.module.int_to_boolean(None),
- None
- )
+ eq_(self.module.int_to_boolean(None), None)
def test_int_to_bool_zero(self):
- eq_(
- self.module.int_to_boolean(0),
- False
- )
+ eq_(self.module.int_to_boolean(0), False)
def test_int_to_bool_one(self):
- eq_(
- self.module.int_to_boolean(1),
- True
- )
+ eq_(self.module.int_to_boolean(1), True)
def test_int_to_bool_positive_int(self):
- eq_(
- self.module.int_to_boolean(12),
- True
- )
+ eq_(self.module.int_to_boolean(12), True)
def test_int_to_bool_negative_int(self):
- eq_(
- self.module.int_to_boolean(-4),
- True
- )
+ eq_(self.module.int_to_boolean(-4), True)
class CBooleanProcessorTest(_BooleanProcessorTest):
- __requires__ = ('cextensions',)
+ __requires__ = ("cextensions",)
@classmethod
def setup_class(cls):
from sqlalchemy import cprocessors
+
cls.module = cprocessors
@@ -48,42 +34,48 @@ class _DateProcessorTest(fixtures.TestBase):
assert_raises_message(
ValueError,
"Couldn't parse date string '2012' - value is not a string",
- self.module.str_to_date, 2012
+ self.module.str_to_date,
+ 2012,
)
def test_datetime_no_string(self):
assert_raises_message(
ValueError,
"Couldn't parse datetime string '2012' - value is not a string",
- self.module.str_to_datetime, 2012
+ self.module.str_to_datetime,
+ 2012,
)
def test_time_no_string(self):
assert_raises_message(
ValueError,
"Couldn't parse time string '2012' - value is not a string",
- self.module.str_to_time, 2012
+ self.module.str_to_time,
+ 2012,
)
def test_date_invalid_string(self):
assert_raises_message(
ValueError,
"Couldn't parse date string: '5:a'",
- self.module.str_to_date, "5:a"
+ self.module.str_to_date,
+ "5:a",
)
def test_datetime_invalid_string(self):
assert_raises_message(
ValueError,
"Couldn't parse datetime string: '5:a'",
- self.module.str_to_datetime, "5:a"
+ self.module.str_to_datetime,
+ "5:a",
)
def test_time_invalid_string(self):
assert_raises_message(
ValueError,
"Couldn't parse time string: '5:a'",
- self.module.str_to_time, "5:a"
+ self.module.str_to_time,
+ "5:a",
)
@@ -91,103 +83,94 @@ class PyDateProcessorTest(_DateProcessorTest):
@classmethod
def setup_class(cls):
from sqlalchemy import processors
+
cls.module = type(
"util",
(object,),
- dict((k, staticmethod(v))
- for k, v in list(processors.py_fallback().items()))
+ dict(
+ (k, staticmethod(v))
+ for k, v in list(processors.py_fallback().items())
+ ),
)
class CDateProcessorTest(_DateProcessorTest):
- __requires__ = ('cextensions',)
+ __requires__ = ("cextensions",)
@classmethod
def setup_class(cls):
from sqlalchemy import cprocessors
+
cls.module = cprocessors
class _DistillArgsTest(fixtures.TestBase):
def test_distill_none(self):
- eq_(
- self.module._distill_params(None, None),
- []
- )
+ eq_(self.module._distill_params(None, None), [])
def test_distill_no_multi_no_param(self):
- eq_(
- self.module._distill_params((), {}),
- []
- )
+ eq_(self.module._distill_params((), {}), [])
def test_distill_dict_multi_none_param(self):
eq_(
- self.module._distill_params(None, {"foo": "bar"}),
- [{"foo": "bar"}]
+ self.module._distill_params(None, {"foo": "bar"}), [{"foo": "bar"}]
)
def test_distill_dict_multi_empty_param(self):
- eq_(
- self.module._distill_params((), {"foo": "bar"}),
- [{"foo": "bar"}]
- )
+ eq_(self.module._distill_params((), {"foo": "bar"}), [{"foo": "bar"}])
def test_distill_single_dict(self):
eq_(
self.module._distill_params(({"foo": "bar"},), {}),
- [{"foo": "bar"}]
+ [{"foo": "bar"}],
)
def test_distill_single_list_strings(self):
eq_(
self.module._distill_params((["foo", "bar"],), {}),
- [["foo", "bar"]]
+ [["foo", "bar"]],
)
def test_distill_single_list_tuples(self):
eq_(
self.module._distill_params(
- ([("foo", "bar"), ("bat", "hoho")],), {}),
- [('foo', 'bar'), ('bat', 'hoho')]
+ ([("foo", "bar"), ("bat", "hoho")],), {}
+ ),
+ [("foo", "bar"), ("bat", "hoho")],
)
def test_distill_single_list_tuple(self):
eq_(
self.module._distill_params(([("foo", "bar")],), {}),
- [('foo', 'bar')]
+ [("foo", "bar")],
)
def test_distill_multi_list_tuple(self):
eq_(
self.module._distill_params(
- ([("foo", "bar")], [("bar", "bat")]), {}),
- ([('foo', 'bar')], [('bar', 'bat')])
+ ([("foo", "bar")], [("bar", "bat")]), {}
+ ),
+ ([("foo", "bar")], [("bar", "bat")]),
)
def test_distill_multi_strings(self):
- eq_(
- self.module._distill_params(("foo", "bar"), {}),
- [('foo', 'bar')]
- )
+ eq_(self.module._distill_params(("foo", "bar"), {}), [("foo", "bar")])
def test_distill_single_list_dicts(self):
eq_(
self.module._distill_params(
- ([{"foo": "bar"}, {"foo": "hoho"}],), {}),
- [{'foo': 'bar'}, {'foo': 'hoho'}]
+ ([{"foo": "bar"}, {"foo": "hoho"}],), {}
+ ),
+ [{"foo": "bar"}, {"foo": "hoho"}],
)
def test_distill_single_string(self):
- eq_(
- self.module._distill_params(("arg",), {}),
- [["arg"]]
- )
+ eq_(self.module._distill_params(("arg",), {}), [["arg"]])
def test_distill_multi_string_tuple(self):
eq_(
self.module._distill_params((("arg", "arg"),), {}),
- [("arg", "arg")]
+ [("arg", "arg")],
)
@@ -195,18 +178,22 @@ class PyDistillArgsTest(_DistillArgsTest):
@classmethod
def setup_class(cls):
from sqlalchemy.engine import util
+
cls.module = type(
"util",
(object,),
- dict((k, staticmethod(v))
- for k, v in list(util.py_fallback().items()))
+ dict(
+ (k, staticmethod(v))
+ for k, v in list(util.py_fallback().items())
+ ),
)
class CDistillArgsTest(_DistillArgsTest):
- __requires__ = ('cextensions', )
+ __requires__ = ("cextensions",)
@classmethod
def setup_class(cls):
from sqlalchemy import cutils as util
+
cls.module = util