Format code using black

This commit is contained in:
jo 2021-05-27 16:23:02 +02:00
parent efe4fa027e
commit c27f020d73
85 changed files with 3238 additions and 2243 deletions

View file

@ -2,6 +2,7 @@
import unittest
from api_clients.utils import ApcUrl, UrlBadParam, IncompleteUrl
class TestApcUrl(unittest.TestCase):
def test_init(self):
url = "/testing"
@ -10,22 +11,23 @@ class TestApcUrl(unittest.TestCase):
def test_params_1(self):
u = ApcUrl("/testing/{key}")
self.assertEqual(u.params(key='val').url(), '/testing/val')
self.assertEqual(u.params(key="val").url(), "/testing/val")
def test_params_2(self):
u = ApcUrl('/testing/{key}/{api}/more_testing')
full_url = u.params(key="AAA",api="BBB").url()
self.assertEqual(full_url, '/testing/AAA/BBB/more_testing')
u = ApcUrl("/testing/{key}/{api}/more_testing")
full_url = u.params(key="AAA", api="BBB").url()
self.assertEqual(full_url, "/testing/AAA/BBB/more_testing")
def test_params_ex(self):
u = ApcUrl("/testing/{key}")
with self.assertRaises(UrlBadParam):
u.params(bad_key='testing')
u.params(bad_key="testing")
def test_url(self):
u = "one/two/three"
self.assertEqual( ApcUrl(u).url(), u )
self.assertEqual(ApcUrl(u).url(), u)
def test_url_ex(self):
u = ApcUrl('/{one}/{two}/three').params(two='testing')
with self.assertRaises(IncompleteUrl): u.url()
u = ApcUrl("/{one}/{two}/three").params(two="testing")
with self.assertRaises(IncompleteUrl):
u.url()