Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add assert test cases #6855

Merged
merged 1 commit into from
Aug 25, 2023
Merged

Add assert test cases #6855

merged 1 commit into from
Aug 25, 2023

Conversation

MichaReiser
Copy link
Member

Summary

This PR adds more assert test cases demonstrating our formatting for when the assert starts
with a parenthesized expression. Black has a neat formatting that avoids
adding the optional parentheses at the left.

The input is how black would format the file

Test Plan

No test for test

@MichaReiser
Copy link
Member Author

MichaReiser commented Aug 24, 2023

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@MichaReiser MichaReiser added the formatter Related to the formatter label Aug 24, 2023
# Trailing assert

def test():
assert (
Copy link
Member Author

Choose a reason for hiding this comment

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

We almost always parenthesize the left which is "wrong"

@github-actions
Copy link
Contributor

PR Check Results

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.01      4.1±0.04ms     9.9 MB/sec    1.00      4.1±0.04ms    10.0 MB/sec
formatter/numpy/ctypeslib.py               1.00    821.9±5.76µs    20.3 MB/sec    1.00    823.0±5.28µs    20.2 MB/sec
formatter/numpy/globals.py                 1.00     80.1±0.30µs    36.8 MB/sec    1.00     79.8±0.28µs    37.0 MB/sec
formatter/pydantic/types.py                1.00  1641.7±13.74µs    15.5 MB/sec    1.00  1642.1±10.46µs    15.5 MB/sec
linter/all-rules/large/dataset.py          1.01     10.4±0.02ms     3.9 MB/sec    1.00     10.4±0.02ms     3.9 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      2.9±0.01ms     5.8 MB/sec    1.00      2.9±0.01ms     5.8 MB/sec
linter/all-rules/numpy/globals.py          1.00    316.1±1.14µs     9.3 MB/sec    1.02    321.8±1.17µs     9.2 MB/sec
linter/all-rules/pydantic/types.py         1.00      5.4±0.01ms     4.7 MB/sec    1.00      5.4±0.04ms     4.7 MB/sec
linter/default-rules/large/dataset.py      1.01      5.5±0.01ms     7.4 MB/sec    1.00      5.5±0.01ms     7.4 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00   1180.0±3.69µs    14.1 MB/sec    1.00   1176.1±1.69µs    14.2 MB/sec
linter/default-rules/numpy/globals.py      1.00    122.5±0.46µs    24.1 MB/sec    1.01    123.3±1.19µs    23.9 MB/sec
linter/default-rules/pydantic/types.py     1.01      2.5±0.01ms    10.1 MB/sec    1.00      2.5±0.02ms    10.2 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.03      6.2±0.41ms     6.6 MB/sec    1.00      6.0±0.25ms     6.8 MB/sec
formatter/numpy/ctypeslib.py               1.00  1224.4±51.32µs    13.6 MB/sec    1.02  1245.5±55.29µs    13.4 MB/sec
formatter/numpy/globals.py                 1.01   123.6±10.66µs    23.9 MB/sec    1.00    122.4±8.42µs    24.1 MB/sec
formatter/pydantic/types.py                1.00      2.5±0.30ms    10.4 MB/sec    1.01      2.5±0.13ms    10.3 MB/sec
linter/all-rules/large/dataset.py          1.01     16.8±0.56ms     2.4 MB/sec    1.00     16.7±0.79ms     2.4 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      4.5±0.13ms     3.7 MB/sec    1.01      4.5±0.17ms     3.7 MB/sec
linter/all-rules/numpy/globals.py          1.00   561.7±27.82µs     5.3 MB/sec    1.02   574.0±22.32µs     5.1 MB/sec
linter/all-rules/pydantic/types.py         1.00      8.5±0.32ms     3.0 MB/sec    1.03      8.8±0.36ms     2.9 MB/sec
linter/default-rules/large/dataset.py      1.00      9.2±0.29ms     4.4 MB/sec    1.00      9.2±0.24ms     4.4 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00  1954.6±69.45µs     8.5 MB/sec    1.00  1957.4±62.89µs     8.5 MB/sec
linter/default-rules/numpy/globals.py      1.02   232.1±14.38µs    12.7 MB/sec    1.00   226.9±10.72µs    13.0 MB/sec
linter/default-rules/pydantic/types.py     1.00      4.1±0.16ms     6.2 MB/sec    1.00      4.1±0.16ms     6.2 MB/sec

@MichaReiser MichaReiser merged commit 61b2ffa into main Aug 25, 2023
17 checks passed
@MichaReiser MichaReiser deleted the add-assert-test-cases branch August 25, 2023 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants