diff --git a/.coveragerc b/.coveragerc index 10e7ca73018..ae0afe8a72a 100644 --- a/.coveragerc +++ b/.coveragerc @@ -12,5 +12,5 @@ omit = [report] show_missing = True precision = 2 -fail_under = 98.26 +fail_under = 98.27 skip_covered = True diff --git a/h/services/annotation_read.py b/h/services/annotation_read.py index 37e123e7e71..56ecb293665 100644 --- a/h/services/annotation_read.py +++ b/h/services/annotation_read.py @@ -46,14 +46,12 @@ def get_annotations_by_id( @staticmethod def _annotation_search_query( - ids: Optional[List[str]] = None, eager_load: Optional[List] = None + ids: List[str] = None, eager_load: Optional[List] = None ) -> Query: """Create a query for searching for annotations.""" query = select(Annotation) - - if ids: - query = query.where(Annotation.id.in_(ids)) + query = query.where(Annotation.id.in_(ids)) if eager_load: query = query.options(*(subqueryload(prop) for prop in eager_load)) diff --git a/tests/h/activity/query_test.py b/tests/h/activity/query_test.py index 0abba14929c..3d1a6432818 100644 --- a/tests/h/activity/query_test.py +++ b/tests/h/activity/query_test.py @@ -389,12 +389,12 @@ def test_it_returns_each_annotation_presented(self, annotations, pyramid_request for bucket in timeframe.document_buckets.values(): presented_annotations.extend(bucket.presented_annotations) - for annotation in annotations: - for presented_annotation in presented_annotations: - if presented_annotation["annotation"].annotation == annotation: - break - else: - assert False + assert set(annotations).intersection( + { + presented_anno["annotation"].annotation + for presented_anno in presented_annotations + } + ) def test_it_returns_each_annotations_group(self, _fetch_groups, pyramid_request): result = execute(pyramid_request, MultiDict(), self.PAGE_SIZE)