Skip to content

Commit

Permalink
ref: fix typing for tests in mypy 1.12.x (#79528)
Browse files Browse the repository at this point in the history
<!-- Describe your PR here. -->
  • Loading branch information
asottile-sentry authored Oct 22, 2024
1 parent 1425c6a commit 23fed35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/sentry/testutils/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,7 @@ def create_team_membership(team, member=None, user=None, role=None):
@staticmethod
@assume_test_silo_mode(SiloMode.CONTROL)
def create_api_key(organization, scope_list=None, **kwargs):
return ApiKey.objects.create(
organization_id=organization.id if organization else None, scope_list=scope_list
)
return ApiKey.objects.create(organization_id=organization.id, scope_list=scope_list)

@staticmethod
@assume_test_silo_mode(SiloMode.CONTROL)
Expand Down
6 changes: 4 additions & 2 deletions tests/sentry/event_manager/grouping/test_assign_to_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ def get_results_from_saving_event(
secondary_hash_calculated = calculate_secondary_hash_spy.call_count == 1

primary_hash = return_values["_calculate_primary_hashes_and_variants"][0][0][0]
primary_hash_found = bool(hash_search_result) and hash_search_result.hash == primary_hash
primary_hash_found = (
hash_search_result is not None and hash_search_result.hash == primary_hash
)

new_group_created = create_group_spy.call_count == 1

Expand All @@ -203,7 +205,7 @@ def get_results_from_saving_event(
secondary_hash = return_values["_calculate_secondary_hashes"][0][0]
hashes_different = secondary_hash != primary_hash
secondary_hash_found = (
bool(hash_search_result) and hash_search_result.hash == secondary_hash
hash_search_result is not None and hash_search_result.hash == secondary_hash
)
secondary_grouphash_existed_already = secondary_hash in existing_grouphashes
secondary_grouphash_exists_now = secondary_hash in post_save_grouphashes
Expand Down

0 comments on commit 23fed35

Please sign in to comment.