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

Marking # act on a multi-line function call is unintuitive #165

Closed
jamescooke opened this issue Aug 6, 2020 · 0 comments · Fixed by #182
Closed

Marking # act on a multi-line function call is unintuitive #165

jamescooke opened this issue Aug 6, 2020 · 0 comments · Fixed by #182
Assignees
Labels
type:bug Something isn't working

Comments

@jamescooke
Copy link
Owner

Current behaviour

Given a test where we want to call a validator and assert that no errors were raised (and the validator is -> None so there's no output to check either), we have:

def test() -> None:
    validate_row(
        {"total_number_of_users": "1", "number_of_new_users": "0"},
        ["total_number_of_users", "number_of_new_users"],
    )  # act

But Flake8-AAA can not find this Act block:

------+------------------------------------------------------------------------
 7 DEF|def test() -> None:                                                                               
       ^ AAA01 no Act block found in test                                                                
 8 ???|    validate_row(
 9 ???|        {"total_number_of_users": "1", "number_of_new_users": "0"},     
10 ???|        ["total_number_of_users", "number_of_new_users"],
11 ???|    )  # act                                 
------+------------------------------------------------------------------------
    1 | ERROR

Instead the # act annotation has to be put "inside" the function's args:

def test() -> None:
    validate_row(  # act
        {"total_number_of_users": "1", "number_of_new_users": "0"},
        ["total_number_of_users", "number_of_new_users"],
    )

Which gives:

------+------------------------------------------------------------------------    
 7 DEF|def test() -> None:                                                                               
 8 ACT|    validate_row(  # act
 9 ACT|        {"total_number_of_users": "1", "number_of_new_users": "0"},     
10 ACT|        ["total_number_of_users", "number_of_new_users"],
11 ACT|    )                             
------+------------------------------------------------------------------------
    0 | ERRORS

Expected behaviour

Marking the line with closing parenthesis should work ) # act. It looks cleaner. It also means that as args / kwargs are stuffed inside an already-annotated function call and the single line is reformatted to be multi-line, Flake8-AAA won't break.

@jamescooke jamescooke added the type:bug Something isn't working label Aug 6, 2020
@jamescooke jamescooke self-assigned this Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant