memgraph/tests/e2e/show_index_info/test_show_index_info.py

48 lines
1.5 KiB
Python
Raw Normal View History

2023-09-11 16:59:41 +08:00
# Copyright 2023 Memgraph Ltd.
#
# Use of this software is governed by the Business Source License
# included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
# License, and you may not use this file except in compliance with the Business Source License.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software will be governed
# by the Apache License, Version 2.0, included in the file
# licenses/APL.txt.
import sys
import pytest
from common import Row, cursor, execute_and_fetch_all
def test_show_index_info(cursor):
index_info = execute_and_fetch_all(cursor, "SHOW INDEX INFO;")
expected_index_info = {
2023-10-28 00:13:05 +08:00
("label", "Anatomy", None, 0),
("label", "Compound", None, 0),
("label", "Disease", None, 0),
("label", "Gene", None, 0),
("label+property", "Compound", "id", 0),
("label+property", "Compound", "inchikey", 0),
("label+property", "Compound", "mgid", 0),
("label+property", "Gene", "i5", 0),
("label+property", "Gene", "id", 0),
2023-09-11 16:59:41 +08:00
}
assert set(index_info) == expected_index_info
def test_index_info_sorted(cursor):
index_info = execute_and_fetch_all(cursor, "SHOW INDEX INFO;")
assert index_info == sorted(
index_info,
key=lambda index: (
index[Row.INDEX_TYPE],
index[Row.LABEL],
index[Row.PROPERTY],
),
)
if __name__ == "__main__":
sys.exit(pytest.main([__file__, "-rA"]))