From 3d96a9839a12649874b6d4cf9466bd3616b0a03c Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 27 Dec 2021 09:26:22 +0100 Subject: [format.python] initial formatting of the python code This patch was generated by black [1]:: make format.python [1] https://github.com/psf/black Signed-off-by: Markus Heiser --- tests/unit/network/test_network.py | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'tests/unit/network') diff --git a/tests/unit/network/test_network.py b/tests/unit/network/test_network.py index 02628760b..d25a0d77b 100644 --- a/tests/unit/network/test_network.py +++ b/tests/unit/network/test_network.py @@ -9,7 +9,6 @@ from tests import SearxTestCase class TestNetwork(SearxTestCase): - def setUp(self): initialize() @@ -51,23 +50,23 @@ class TestNetwork(SearxTestCase): network = Network(proxies='http://localhost:1337') self.assertEqual(next(network._proxies_cycle), (('all://', 'http://localhost:1337'),)) - network = Network(proxies={ - 'https': 'http://localhost:1337', - 'http': 'http://localhost:1338' - }) - self.assertEqual(next(network._proxies_cycle), - (('https://', 'http://localhost:1337'), ('http://', 'http://localhost:1338'))) - self.assertEqual(next(network._proxies_cycle), - (('https://', 'http://localhost:1337'), ('http://', 'http://localhost:1338'))) - - network = Network(proxies={ - 'https': ['http://localhost:1337', 'http://localhost:1339'], - 'http': 'http://localhost:1338' - }) - self.assertEqual(next(network._proxies_cycle), - (('https://', 'http://localhost:1337'), ('http://', 'http://localhost:1338'))) - self.assertEqual(next(network._proxies_cycle), - (('https://', 'http://localhost:1339'), ('http://', 'http://localhost:1338'))) + network = Network(proxies={'https': 'http://localhost:1337', 'http': 'http://localhost:1338'}) + self.assertEqual( + next(network._proxies_cycle), (('https://', 'http://localhost:1337'), ('http://', 'http://localhost:1338')) + ) + self.assertEqual( + next(network._proxies_cycle), (('https://', 'http://localhost:1337'), ('http://', 'http://localhost:1338')) + ) + + network = Network( + proxies={'https': ['http://localhost:1337', 'http://localhost:1339'], 'http': 'http://localhost:1338'} + ) + self.assertEqual( + next(network._proxies_cycle), (('https://', 'http://localhost:1337'), ('http://', 'http://localhost:1338')) + ) + self.assertEqual( + next(network._proxies_cycle), (('https://', 'http://localhost:1339'), ('http://', 'http://localhost:1338')) + ) with self.assertRaises(ValueError): Network(proxies=1) @@ -134,6 +133,7 @@ class TestNetworkRequestRetries(SearxTestCase): first = False return httpx.Response(status_code=403, text=TestNetworkRequestRetries.TEXT) return httpx.Response(status_code=200, text=TestNetworkRequestRetries.TEXT) + return get_response async def test_retries_ok(self): @@ -206,6 +206,7 @@ class TestNetworkStreamRetries(SearxTestCase): first = False raise httpx.RequestError('fake exception', request=None) return httpx.Response(status_code=200, text=TestNetworkStreamRetries.TEXT) + return stream async def test_retries_ok(self): -- cgit v1.2.3