self = <swh.search.tests.test_in_memory.InmemorySearchTest testMethod=test_origin_intrinsic_metadata_inconsistent_type>
def test_origin_intrinsic_metadata_inconsistent_type(self):
"""Checks the same field can have a concrete value, an object, or an array
in different documents."""
origin1_foobar = {"url": "http://origin1"}
origin2_barbaz = {"url": "http://origin2"}
origin3_bazqux = {"url": "http://origin3"}
self.search.origin_update(
[
{
**origin1_foobar,
"intrinsic_metadata": {
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"author": {"familyName": "Foo", "givenName": "Bar",},
},
},
]
)
self.search.flush()
self.search.origin_update(
[
{
**origin2_barbaz,
"intrinsic_metadata": {
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"author": "Bar Baz",
},
},
{
**origin3_bazqux,
"intrinsic_metadata": {
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"author": ["Baz", "Qux"],
},
},
]
)
self.search.flush()
actual_page = self.search.origin_search(metadata_pattern="bar")
assert actual_page.next_page_token is None
results = [r["url"] for r in actual_page.results]
expected_results = [o["url"] for o in [origin2_barbaz, origin1_foobar]]
> assert sorted(results) == sorted(expected_results)
E AssertionError: assert [] == ['http://orig...tp://origin2']
E Right contains 2 more items, first extra item: 'http://origin1'
E Full diff:
E - ['http://origin1', 'http://origin2']
E + []
.tox/py3/lib/python3.7/site-packages/swh/search/tests/test_search.py:661: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jun 23 2021, 6:04 PM