Skip to content

fix: show not_ prefix in call log when negative assertions fail#3033

Merged
Skn0tt merged 3 commits into
microsoft:mainfrom
scitech:tgould/improve-isnot-call-log-print
Jul 22, 2026
Merged

fix: show not_ prefix in call log when negative assertions fail#3033
Skn0tt merged 3 commits into
microsoft:mainfrom
scitech:tgould/improve-isnot-call-log-print

Conversation

@scitech

@scitech scitech commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

When a negative assertion like not_to_be_visible fails, the call log prints the name of the positive assertion, which contradicts the error message and is kind of confusing if you're reading quickly. For example:

AssertionError: Locator expected not to be visible
Actual value: visible 
Call log:
  - Expect "to_be_visible" with timeout 3000ms
  - waiting for locator("#some-id").first
    7 × locator resolved to <svg id="some-id">…</svg>
      - unexpected value "visible"

With this PR, it will say not_to_be_visible, like so:

AssertionError: Locator expected not to be visible
Actual value: visible 
Call log:
  - Expect "not_to_be_visible" with timeout 3000ms
  - waiting for locator("#some-id").first
    7 × locator resolved to <svg id="some-id">…</svg>
      - unexpected value "visible"

@scitech

scitech commented Feb 11, 2026

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@Skn0tt
Skn0tt self-requested a review April 30, 2026 09:37

@Skn0tt Skn0tt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, but i'm unsure why CI did not run 🤔

Comment thread tests/async/test_assertions.py Outdated
@Skn0tt
Skn0tt merged commit c3eff76 into microsoft:main Jul 22, 2026
34 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants