From bceaf2820a9d270958a2d15444a19c76f3ea3543 Mon Sep 17 00:00:00 2001 From: yashaka Date: Fri, 22 Apr 2022 19:29:33 +0300 Subject: [PATCH] CHORE: fix black style violations --- examples/custom_conditions.py | 53 ++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/examples/custom_conditions.py b/examples/custom_conditions.py index 8fb01960..7749c2dc 100644 --- a/examples/custom_conditions.py +++ b/examples/custom_conditions.py @@ -60,12 +60,16 @@ def test_wait_for_produced_todos_v2(): def test_wait_for_notification_after_reload_v1(): - browser.open('https://the-internet.herokuapp.com/notification_message_rendered') + browser.open( + 'https://the-internet.herokuapp.com/notification_message_rendered' + ) def assert_action_successful_on_reload(entity): browser.element('[href*=notification_message]').click() - if not browser.element('#flash').matching(have.exact_text('Action successful\n×')): + if not browser.element('#flash').matching( + have.exact_text('Action successful\n×') + ): raise AssertionError('wrong message received') browser.wait.for_(assert_action_successful_on_reload) @@ -76,7 +80,9 @@ def test_wait_for_notification_after_reload_v2(): more descriptive implementation with custom rendering of error message on failure """ - browser.open('https://the-internet.herokuapp.com/notification_message_rendered') + browser.open( + 'https://the-internet.herokuapp.com/notification_message_rendered' + ) def assert_action_successful_on_reload(entity): browser.element('[href*=notification_message]').click() @@ -114,7 +120,9 @@ def test_wait_for_notification_after_reload_v3(): - that should be browser if condition was called on a browser object """ - browser.open('https://the-internet.herokuapp.com/notification_message_rendered') + browser.open( + 'https://the-internet.herokuapp.com/notification_message_rendered' + ) def notification_on_reload(message: str) -> BrowserCondition: def fn(entity: Browser): @@ -137,8 +145,9 @@ def fn(entity: Browser): ) browser.wait.for_( - notification_on_reload('Action successful\n×') - .or_(notification_on_reload('Action unsuccesful, please try again\n×')) + notification_on_reload('Action successful\n×').or_( + notification_on_reload('Action unsuccesful, please try again\n×') + ) ) @@ -146,7 +155,9 @@ def test_wait_for_notification_after_reload_v4(): """ with default rendering (built into selene's condition) of error message on failure """ - browser.open('https://the-internet.herokuapp.com/notification_message_rendered') + browser.open( + 'https://the-internet.herokuapp.com/notification_message_rendered' + ) def assert_action_successful_on_reload(entity): browser.element('[href*=notification_message]').click() @@ -160,12 +171,16 @@ def test_wait_for_notification_after_reload_v5(): with default rendering (built into selene's condition) of error message on failure AND simplified syntax with lambdas """ - browser.open('https://the-internet.herokuapp.com/notification_message_rendered') + browser.open( + 'https://the-internet.herokuapp.com/notification_message_rendered' + ) - browser.wait.for_(lambda _: ( - browser.element('[href*=notification_message]').click(), - have.exact_text('Action successful\n×')(browser.element('#flash')), - )) + browser.wait.for_( + lambda _: ( + browser.element('[href*=notification_message]').click(), + have.exact_text('Action successful\n×')(browser.element('#flash')), + ) + ) def test_wait_for_notification_after_reload_v6(): @@ -174,12 +189,16 @@ def test_wait_for_notification_after_reload_v6(): and simplified syntax with lambdas AND with optimised performance and removed potential side effects of "nested waiting" """ - browser.open('https://the-internet.herokuapp.com/notification_message_rendered') + browser.open( + 'https://the-internet.herokuapp.com/notification_message_rendered' + ) - browser.wait.for_(lambda _: ( - browser.element('[href*=notification_message]')().click(), - have.exact_text('Action successful\n×')(browser.element('#flash')), - )) + browser.wait.for_( + lambda _: ( + browser.element('[href*=notification_message]')().click(), + have.exact_text('Action successful\n×')(browser.element('#flash')), + ) + ) ''' notice how we called `().click()` instead of `.click()` on notification element extra parenthesis allows to get actual webelement