self = <swh.indexer.tests.storage.test_storage.TestIndexerStorageContentCTags object at 0x7f043688b898>
swh_indexer_storage_with_data = (<swh.indexer.storage.in_memory.IndexerStorage object at 0x7f043688b9b0>, {'tools': {'universal-ctags': {'id': -376720...xe0O0a\x16\xf6\xb4NJ\x0f\r\x13\x9a\xd3\xe1X', 'licenses': [b'MIT'], 'indexer_configuration_id': 3302242932100936686}]})
def test_content_ctags_search(self, swh_indexer_storage_with_data):
storage, data = swh_indexer_storage_with_data
# 1. given
tool = data.tools["universal-ctags"]
tool_id = tool["id"]
ctag1 = {
"id": data.sha1_1,
"indexer_configuration_id": tool_id,
"ctags": [
{"name": "hello", "kind": "function", "line": 133, "lang": "Python",},
{"name": "counter", "kind": "variable", "line": 119, "lang": "Python",},
{"name": "hello", "kind": "variable", "line": 210, "lang": "Python",},
],
}
ctag2 = {
"id": data.sha1_2,
"indexer_configuration_id": tool_id,
"ctags": [
{"name": "hello", "kind": "variable", "line": 100, "lang": "C",},
{"name": "result", "kind": "variable", "line": 120, "lang": "C",},
],
}
storage.content_ctags_add([ctag1, ctag2])
# 1. when
actual_ctags = list(storage.content_ctags_search("hello", limit=1))
# 1. then
assert actual_ctags == [
{
"id": ctag1["id"],
"tool": tool,
"name": "hello",
"kind": "function",
"line": 133,
"lang": "Python",
}
]
# 2. when
actual_ctags = list(
storage.content_ctags_search("hello", limit=1, last_sha1=ctag1["id"])
)
# 2. then
assert actual_ctags == [
{
"id": ctag2["id"],
"tool": tool,
"name": "hello",
"kind": "variable",
"line": 100,
"lang": "C",
}
]
# 3. when
actual_ctags = list(storage.content_ctags_search("hello"))
# 3. then
> assert actual_ctags == [
{
"id": ctag1["id"],
"tool": tool,
"name": "hello",
"kind": "function",
"line": 133,
"lang": "Python",
},
{
"id": ctag1["id"],
"tool": tool,
"name": "hello",
"kind": "variable",
"line": 210,
"lang": "Python",
},
{
"id": ctag2["id"],
"tool": tool,
"name": "hello",
"kind": "variable",
"line": 100,
"lang": "C",
},
]
E AssertionError: assert [{'id': b'4\x...e': 100, ...}] == [{'id': b'4\x...e': 100, ...}]
E At index 2 diff: {'id': b'4\x972t\xcc\xefj\xb4\xdf\xaa\xf8e\x99y/\xa9\xc3\xfeF\x89', 'tool': {'id': -3767208038498119754, 'name': 'universal-ctags', 'version': '~git7859817b', 'configuration': {'command_line': 'ctags --fields=+lnz --sort=no --links=no --output-format=json <filepath>'}}, 'name': 'hello', 'kind': 'function', 'line': 133, 'lang': 'Python'} != {'id': b'a\xc2\xb3\xa3\x04\x96\xd3)\xe2\x1a\xf7\r\xd2\xd7\xe0\x97\x04m\x07\xb7', 'tool': {'id': -3767208038498119754, 'name': 'universal-ctags', 'version': '~git7859817b', 'configuration': {'command_line': 'ctags --fi...
E
E ...Full output truncated (71 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/indexer/tests/storage/test_storage.py:600: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Oct 1 2020, 12:15 PM