chore: blacken (#772)
diff --git a/tests/test__helpers.py b/tests/test__helpers.py
index e33ea71..90c75ef 100644
--- a/tests/test__helpers.py
+++ b/tests/test__helpers.py
@@ -25,10 +25,8 @@
class PositionalTests(unittest.TestCase):
-
def test_usage(self):
- _helpers.positional_parameters_enforcement = (
- _helpers.POSITIONAL_EXCEPTION)
+ _helpers.positional_parameters_enforcement = _helpers.POSITIONAL_EXCEPTION
# 1 positional arg, 1 keyword-only arg.
@_helpers.positional(1)
@@ -60,10 +58,9 @@
with self.assertRaises(TypeError):
function3(1, 2)
- @mock.patch('googleapiclient._helpers.logger')
+ @mock.patch("googleapiclient._helpers.logger")
def test_enforcement_warning(self, mock_logger):
- _helpers.positional_parameters_enforcement = (
- _helpers.POSITIONAL_WARNING)
+ _helpers.positional_parameters_enforcement = _helpers.POSITIONAL_WARNING
@_helpers.positional(1)
def function(pos, kwonly=None):
@@ -72,7 +69,7 @@
self.assertTrue(function(1, 2))
self.assertTrue(mock_logger.warning.called)
- @mock.patch('googleapiclient._helpers.logger')
+ @mock.patch("googleapiclient._helpers.logger")
def test_enforcement_ignore(self, mock_logger):
_helpers.positional_parameters_enforcement = _helpers.POSITIONAL_IGNORE
@@ -85,24 +82,22 @@
class AddQueryParameterTests(unittest.TestCase):
-
def test__add_query_parameter(self):
+ self.assertEqual(_helpers._add_query_parameter("/action", "a", None), "/action")
self.assertEqual(
- _helpers._add_query_parameter('/action', 'a', None),
- '/action')
+ _helpers._add_query_parameter("/action", "a", "b"), "/action?a=b"
+ )
self.assertEqual(
- _helpers._add_query_parameter('/action', 'a', 'b'),
- '/action?a=b')
- self.assertEqual(
- _helpers._add_query_parameter('/action?a=b', 'a', 'c'),
- '/action?a=c')
+ _helpers._add_query_parameter("/action?a=b", "a", "c"), "/action?a=c"
+ )
# Order is non-deterministic.
self.assertIn(
- _helpers._add_query_parameter('/action?a=b', 'c', 'd'),
- ['/action?a=b&c=d', '/action?c=d&a=b'])
+ _helpers._add_query_parameter("/action?a=b", "c", "d"),
+ ["/action?a=b&c=d", "/action?c=d&a=b"],
+ )
self.assertEqual(
- _helpers._add_query_parameter('/action', 'a', ' ='),
- '/action?a=+%3D')
+ _helpers._add_query_parameter("/action", "a", " ="), "/action?a=+%3D"
+ )
def assertUrisEqual(testcase, expected, actual):
@@ -123,39 +118,37 @@
class Test_update_query_params(unittest.TestCase):
-
def test_update_query_params_no_params(self):
- uri = 'http://www.google.com'
- updated = _helpers.update_query_params(uri, {'a': 'b'})
- self.assertEqual(updated, uri + '?a=b')
+ uri = "http://www.google.com"
+ updated = _helpers.update_query_params(uri, {"a": "b"})
+ self.assertEqual(updated, uri + "?a=b")
def test_update_query_params_existing_params(self):
- uri = 'http://www.google.com?x=y'
- updated = _helpers.update_query_params(uri, {'a': 'b', 'c': 'd&'})
- hardcoded_update = uri + '&a=b&c=d%26'
+ uri = "http://www.google.com?x=y"
+ updated = _helpers.update_query_params(uri, {"a": "b", "c": "d&"})
+ hardcoded_update = uri + "&a=b&c=d%26"
assertUrisEqual(self, updated, hardcoded_update)
def test_update_query_params_replace_param(self):
- base_uri = 'http://www.google.com'
- uri = base_uri + '?x=a'
- updated = _helpers.update_query_params(uri, {'x': 'b', 'y': 'c'})
- hardcoded_update = base_uri + '?x=b&y=c'
+ base_uri = "http://www.google.com"
+ uri = base_uri + "?x=a"
+ updated = _helpers.update_query_params(uri, {"x": "b", "y": "c"})
+ hardcoded_update = base_uri + "?x=b&y=c"
assertUrisEqual(self, updated, hardcoded_update)
def test_update_query_params_repeated_params(self):
- uri = 'http://www.google.com?x=a&x=b'
+ uri = "http://www.google.com?x=a&x=b"
with self.assertRaises(ValueError):
- _helpers.update_query_params(uri, {'a': 'c'})
+ _helpers.update_query_params(uri, {"a": "c"})
class Test_parse_unique_urlencoded(unittest.TestCase):
-
def test_without_repeats(self):
- content = 'a=b&c=d'
+ content = "a=b&c=d"
result = _helpers.parse_unique_urlencoded(content)
- self.assertEqual(result, {'a': 'b', 'c': 'd'})
+ self.assertEqual(result, {"a": "b", "c": "d"})
def test_with_repeats(self):
- content = 'a=b&a=d'
+ content = "a=b&a=d"
with self.assertRaises(ValueError):
_helpers.parse_unique_urlencoded(content)