summaryrefslogtreecommitdiff
path: root/tests/unit/network
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2021-12-27 09:26:22 +0100
committerMarkus Heiser <markus.heiser@darmarit.de>2021-12-27 09:26:22 +0100
commit3d96a9839a12649874b6d4cf9466bd3616b0a03c (patch)
treee7d54d1e345b1e792d538ddc250f4827bb2fd9b9 /tests/unit/network
parentfcdc2c2cd26e24c2aa3f064d93cee3e29dc2a30c (diff)
downloadsearxng-3d96a9839a12649874b6d4cf9466bd3616b0a03c.tar.gz
searxng-3d96a9839a12649874b6d4cf9466bd3616b0a03c.zip
[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 <markus.heiser@darmarit.de>
Diffstat (limited to 'tests/unit/network')
-rw-r--r--tests/unit/network/test_network.py37
1 files changed, 19 insertions, 18 deletions
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):