diff --git a/setup.py b/setup.py index 992a6a00e..9c867c05f 100644 --- a/setup.py +++ b/setup.py @@ -40,10 +40,7 @@ def get_version_data() -> dict: "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 3", ] - + [ - ("Programming Language :: Python :: %s" % x) - for x in "3.8 3.9 3.10 3.11 3.12".split() - ], + + [("Programming Language :: Python :: %s" % x) for x in "3.8 3.9 3.10 3.11 3.12".split()], project_urls={ "Documentation": "https://splinter.readthedocs.io/", "Changelog": "https://github.com/cobrateam/splinter/tree/master/docs/news", diff --git a/splinter/driver/__init__.py b/splinter/driver/__init__.py index 8db227891..4ca3622df 100644 --- a/splinter/driver/__init__.py +++ b/splinter/driver/__init__.py @@ -263,8 +263,7 @@ def is_text_present(self, text: str, wait_time: Optional[int] = None) -> bool: bool: True if finds a match for the ``text`` and False if not. """ raise NotImplementedError( - "%s doesn't support checking if some text is present in the html. " - % self.driver_name, + "%s doesn't support checking if some text is present in the html. " % self.driver_name, ) def type(self, name: str, value: str, slowly: bool = False) -> str: # NOQA: A003 @@ -385,8 +384,7 @@ def select(self, name: str, value: str) -> None: >>> browser.select("state", "NY") """ raise NotImplementedError( - "%s doesn't support selecting options in 'select' element." - % self.driver_name, + "%s doesn't support selecting options in 'select' element." % self.driver_name, ) def quit(self) -> None: # NOQA: A003 @@ -408,8 +406,7 @@ def is_element_present_by_css( bool: True if the element is present and False if is not present. """ raise NotImplementedError( - "%s doesn't support verifying if element is present by css" - % self.driver_name, + "%s doesn't support verifying if element is present by css" % self.driver_name, ) def is_element_not_present_by_css( @@ -427,8 +424,7 @@ def is_element_not_present_by_css( bool: True if the element is not present and False if is present. """ raise NotImplementedError( - "%s doesn't support verifying if element is not present by css" - % self.driver_name, + "%s doesn't support verifying if element is not present by css" % self.driver_name, ) def is_element_present_by_xpath( @@ -446,8 +442,7 @@ def is_element_present_by_xpath( bool: True if the element is present and False if is not present. """ raise NotImplementedError( - "%s doesn't support verifying if element is present by xpath" - % self.driver_name, + "%s doesn't support verifying if element is present by xpath" % self.driver_name, ) def is_element_not_present_by_xpath( @@ -465,8 +460,7 @@ def is_element_not_present_by_xpath( bool: True if the element is not present and False if is present. """ raise NotImplementedError( - "%s doesn't support verifying if element is not present by xpath" - % self.driver_name, + "%s doesn't support verifying if element is not present by xpath" % self.driver_name, ) def is_element_present_by_tag( @@ -484,8 +478,7 @@ def is_element_present_by_tag( bool: True if the element is present and False if is not present. """ raise NotImplementedError( - "%s doesn't support verifying if element is present by tag" - % self.driver_name, + "%s doesn't support verifying if element is present by tag" % self.driver_name, ) def is_element_not_present_by_tag( @@ -503,8 +496,7 @@ def is_element_not_present_by_tag( bool: True if the element is not present and False if is present. """ raise NotImplementedError( - "%s doesn't support verifying if element is not present by tag" - % self.driver_name, + "%s doesn't support verifying if element is not present by tag" % self.driver_name, ) def is_element_present_by_name( @@ -522,8 +514,7 @@ def is_element_present_by_name( bool: True if the element is present and False if is not present. """ raise NotImplementedError( - "%s doesn't support verifying if element is present by name" - % self.driver_name, + "%s doesn't support verifying if element is present by name" % self.driver_name, ) def is_element_not_present_by_name( @@ -541,8 +532,7 @@ def is_element_not_present_by_name( bool: True if the element is not present and False if is present. """ raise NotImplementedError( - "%s doesn't support verifying if element is not present by name" - % self.driver_name, + "%s doesn't support verifying if element is not present by name" % self.driver_name, ) def is_element_present_by_value( @@ -560,8 +550,7 @@ def is_element_present_by_value( bool: True if the element is present and False if is not present. """ raise NotImplementedError( - "%s doesn't support verifying if element is present by value" - % self.driver_name, + "%s doesn't support verifying if element is present by value" % self.driver_name, ) def is_element_not_present_by_value( @@ -579,8 +568,7 @@ def is_element_not_present_by_value( bool: True if the element is not present and False if is present. """ raise NotImplementedError( - "%s doesn't support verifying if element is not present by value" - % self.driver_name, + "%s doesn't support verifying if element is not present by value" % self.driver_name, ) def is_element_present_by_text( @@ -598,8 +586,7 @@ def is_element_present_by_text( bool: True if the element is present and False if is not present. """ raise NotImplementedError( - "%s doesn't support verifying if element is present by text" - % self.driver_name, + "%s doesn't support verifying if element is present by text" % self.driver_name, ) def is_element_not_present_by_text( @@ -617,8 +604,7 @@ def is_element_not_present_by_text( bool: True if the element is not present and False if is present. """ raise NotImplementedError( - "%s doesn't support verifying if element is not present by text" - % self.driver_name, + "%s doesn't support verifying if element is not present by text" % self.driver_name, ) def is_element_present_by_id( @@ -636,8 +622,7 @@ def is_element_present_by_id( bool: True if the element is present and False if is not present. """ raise NotImplementedError( - "%s doesn't support verifying if element is present by id" - % self.driver_name, + "%s doesn't support verifying if element is present by id" % self.driver_name, ) def is_element_not_present_by_id( @@ -655,8 +640,7 @@ def is_element_not_present_by_id( bool: True if the element is not present and False if is present. """ raise NotImplementedError( - "%s doesn't support verifying if element is not present by id" - % self.driver_name, + "%s doesn't support verifying if element is not present by id" % self.driver_name, ) def screenshot( diff --git a/splinter/driver/djangoclient.py b/splinter/driver/djangoclient.py index 0565c79f5..4eafd56b7 100644 --- a/splinter/driver/djangoclient.py +++ b/splinter/driver/djangoclient.py @@ -42,9 +42,7 @@ def __contains__(self, key): def __eq__(self, other_object): if isinstance(other_object, dict): - cookies_dict = { - key: morsel.value for key, morsel in self.driver.cookies.items() - } + cookies_dict = {key: morsel.value for key, morsel in self.driver.cookies.items()} return cookies_dict == other_object return False diff --git a/splinter/driver/lxmldriver.py b/splinter/driver/lxmldriver.py index 810a404d1..4d42578e7 100644 --- a/splinter/driver/lxmldriver.py +++ b/splinter/driver/lxmldriver.py @@ -111,9 +111,7 @@ def back(self): ) def forward(self): - if (self._last_url_index >= 0) and ( - self._last_url_index < len(self._last_urls) - 1 - ): + if (self._last_url_index >= 0) and (self._last_url_index < len(self._last_urls) - 1): self._last_url_index += 1 self._do_method( "get", diff --git a/splinter/driver/webdriver/__init__.py b/splinter/driver/webdriver/__init__.py index 9390aeb6c..02edbd26c 100644 --- a/splinter/driver/webdriver/__init__.py +++ b/splinter/driver/webdriver/__init__.py @@ -200,10 +200,7 @@ def fset(self, value): def __repr__(self): return str( - [ - Window(self._browser, handle) - for handle in self._browser.driver.window_handles - ], + [Window(self._browser, handle) for handle in self._browser.driver.window_handles], ) @@ -237,9 +234,7 @@ def _find(self, finder, finder_kwargs=None): pass if elements: - elem_list = [ - self.element_class(element, self, finder_kwargs) for element in elements - ] + elem_list = [self.element_class(element, self, finder_kwargs) for element in elements] return elem_list @@ -552,10 +547,7 @@ def fill_form(self, field_values, form_id=None, name=None, ignore_missing=False) else: elements = self.find_by_name(name) element = elements.first - if ( - element["type"] in ["text", "password", "tel"] - or element.tag_name == "textarea" - ): + if element["type"] in ["text", "password", "tel"] or element.tag_name == "textarea": element.value = value elif element["type"] == "checkbox": if value: diff --git a/splinter/driver/zopetestbrowser.py b/splinter/driver/zopetestbrowser.py index 89e6964f7..0fee93c7b 100644 --- a/splinter/driver/zopetestbrowser.py +++ b/splinter/driver/zopetestbrowser.py @@ -233,9 +233,7 @@ def fill_form(self, field_values, form_id=None, name=None, ignore_missing=False) else: control.value = [] elif control.type == "radio": - control.value = [ - option for option in control.options if option == value - ] + control.value = [option for option in control.options if option == value] elif control.type == "select": control.value = [value] else: diff --git a/splinter/meta.py b/splinter/meta.py index 8cf8bc4f9..30e4bcb35 100644 --- a/splinter/meta.py +++ b/splinter/meta.py @@ -11,9 +11,7 @@ def __new__( dict: dict, ) -> type: # NOQA: N804, A002 """Metaclass that forces inheritance of docstrings.""" - items_to_patch = [ - (k, v) for k, v in dict.items() if not k.startswith("__") and not v.__doc__ - ] + items_to_patch = [(k, v) for k, v in dict.items() if not k.startswith("__") and not v.__doc__] for name, obj in items_to_patch: doc = None for base in bases: diff --git a/tests/element_does_not_exist.py b/tests/element_does_not_exist.py index 9993fa3fa..ed1cde798 100644 --- a/tests/element_does_not_exist.py +++ b/tests/element_does_not_exist.py @@ -29,9 +29,7 @@ def test_element_list_contains_right_information_and_raises_right_exception(self self.assertEqual(".element-that-dont-exists", element_list.query) element_list.first - expected_message = ( - 'no elements could be found with css ".element-that-dont-exists"' - ) + expected_message = 'no elements could be found with css ".element-that-dont-exists"' e = cm.exception self.assertEqual(expected_message, e.args[0]) @@ -48,9 +46,7 @@ def test_element_list_raises_when_element_first_doesnt_exists_in_element_context self.assertEqual(".inner-element-that-dont-exists", element_list.query) element_list.first - expected_message = ( - 'no elements could be found with css ".inner-element-that-dont-exists"' - ) + expected_message = 'no elements could be found with css ".inner-element-that-dont-exists"' e = cm.exception self.assertEqual(expected_message, e.args[0]) diff --git a/tests/fake_webapp.py b/tests/fake_webapp.py index 4c6587f9d..ccd5bab60 100644 --- a/tests/fake_webapp.py +++ b/tests/fake_webapp.py @@ -46,8 +46,7 @@ def check_auth(username, password): def authenticate(): """Sends a 401 response that enables basic auth""" return Response( - "Could not verify your access level for that URL.\n" - "You have to login with proper credentials", + "Could not verify your access level for that URL.\n" "You have to login with proper credentials", 401, {"WWW-Authenticate": 'Basic realm="Login Required"'}, ) diff --git a/tests/test_djangoclient.py b/tests/test_djangoclient.py index cc3bd1577..b43b84715 100644 --- a/tests/test_djangoclient.py +++ b/tests/test_djangoclient.py @@ -129,8 +129,7 @@ def test_links_with_nested_tags_xpath(self): self.assertEqual( len(links), 1, - 'Found not exactly one link with a span with text "BAR ONE". %s' - % [item.outer_html for item in links], + 'Found not exactly one link with a span with text "BAR ONE". %s' % [item.outer_html for item in links], ) def test_finding_all_links_by_non_ascii_text(self): diff --git a/tests/test_flaskclient.py b/tests/test_flaskclient.py index c8996f33c..cb16813e2 100644 --- a/tests/test_flaskclient.py +++ b/tests/test_flaskclient.py @@ -142,8 +142,7 @@ def test_links_with_nested_tags_xpath(self): self.assertEqual( len(links), 1, - 'Found not exactly one link with a span with text "BAR ONE". %s' - % [item.outer_html for item in links], + 'Found not exactly one link with a span with text "BAR ONE". %s' % [item.outer_html for item in links], ) def test_finding_all_links_by_non_ascii_text(self): diff --git a/tests/test_zopetestbrowser.py b/tests/test_zopetestbrowser.py index cb8d4ba35..1b9770843 100644 --- a/tests/test_zopetestbrowser.py +++ b/tests/test_zopetestbrowser.py @@ -138,8 +138,7 @@ def test_links_with_nested_tags_xpath(self): self.assertEqual( len(links), 1, - 'Found not exactly one link with a span with text "BAR ONE". %s' - % [item.outer_html for item in links], + 'Found not exactly one link with a span with text "BAR ONE". %s' % [item.outer_html for item in links], ) def test_finding_all_links_by_non_ascii_text(self):