From 4e0bd58e8d82d960c02ff30a87ba4625dc96281a Mon Sep 17 00:00:00 2001 From: yashaka Date: Wed, 10 Jul 2024 13:18:19 +0300 Subject: [PATCH] DOCS: review TODOS and mention important in changelog --- CHANGELOG.md | 21 +++++++++++---------- selene/core/condition.py | 14 +++++++------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b3e94ed..4ffe024d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -118,10 +118,6 @@ TODOs: seems like currently we do raise, but cover with tests -### TODO: conditions can read options from config? commands/queries can read them? - -especially relevant for have.texts to turn on/off ignoring invisible elements - ### TODO: add `<` before driver.switch_to.* tab in iframe faq doc ### TODO: All and AllElements aliases to Collection (maybe even deprecate Collection) @@ -189,21 +185,26 @@ Then we have to consider rething condition.__call__ aliases... And corresponding `Test` might be also a good candidate over `Match` ... But `Test` does not correlate in `entity.should(Test(actual=..., by=...)) -### TODO: consider removing Callable[[], str] as supported type for description in Condition +### TODO: Ensure type errors on element.should(collection_condition), etc. +### TODO: check if there are no type errors on passing be._empty to should ### TODO: decide on ... vs (...,) as one_or_more ### TODO: ensure no warnings -### TODO: rename all conditions inside match.py so match can be fully used instead be + have #530 +### TODO: Consider passing Condition instance as by in Match -### TODO: check if there are no type errors on passing be._empty to should +like in `clickable = Match('clickable', by=be.visible.and_(be.enabled))` + +### TODO: Consider privatizing Condition actual and by params + +should we even refactor out them from Condition and move to Match only? -### Consider making configurable the "filtering collection for visibility" in size condition +### TODO: rename all conditions inside match.py so match can be fully used instead be + have #530 -### Consider changing name type from str | Callable[[], str] to str | Callable[[E], str], +### TODO: Consider making configurable the "filtering collection for visibility" in size condition -### Ensure type errors on element.should(collection_condition), etc. +### TODO: Consider changing name type from str | Callable[[], str] to str | Callable[[E], str], ### Deprecated conditions diff --git a/selene/core/condition.py b/selene/core/condition.py index 25672784..26cd1e28 100644 --- a/selene/core/condition.py +++ b/selene/core/condition.py @@ -1092,7 +1092,7 @@ def each(self) -> Condition[Iterable[E]]: # as, finally, the test param is more unhandy in straightforward inline usage # – So far, YES, it seemed like a good idea to get rid of test param in Match # narrowing the usage for the end user to the most convenient one... -# Hm... but what about redefining conditions based on existing ones? +# TODO: Hm... but what about redefining conditions based on existing ones? # Imagine: # $('#save').should(Match('«Save document» is shown', test=be.visible)) # Such case is rare, and looks like not optimal, because there are better @@ -1572,7 +1572,7 @@ def __init__( name = name or ( ((str(actual_name) + ' ') if actual_name else '') + str(by_name) # noqa ) - # TODO: fix "cannot infer type of argument 1 of __init__" or ignore + # todo: fix "cannot infer type of argument 1 of __init__" or ignore super().__init__( # type: ignore name, actual=actual, # type: ignore @@ -1595,11 +1595,11 @@ def __init__( # Match(lambda x: x > 0) # Match(lambda actual: actual - 1, lambda res: res > 0) # Match('has positive decrement', lambda actual: actual - 1, lambda res: res > 0) -Match( - lambda: 'has positive decrement', - actual=lambda actual: actual - 1, - by=lambda res: res > 0, -) +# Match( +# lambda: 'has positive decrement', +# actual=lambda actual: actual - 1, +# by=lambda res: res > 0, +# ) # Match( # lambda: 'has positive decrement', # by=lambda res: res > 0,