mirror of
https://github.com/microsoft/graphrag.git
synced 2025-07-03 23:19:35 +00:00
22 lines
661 B
Python
22 lines
661 B
Python
![]() |
# Copyright (c) 2024 Microsoft Corporation.
|
||
|
# Licensed under the MIT License
|
||
|
|
||
|
import pytest
|
||
|
|
||
|
from graphrag.utils.embeddings import create_collection_name
|
||
|
|
||
|
|
||
|
def test_create_collection_name():
|
||
|
collection = create_collection_name("default", "entity.title")
|
||
|
assert collection == "default-entity-title"
|
||
|
|
||
|
|
||
|
def test_create_collection_name_invalid_embedding_throws():
|
||
|
with pytest.raises(KeyError):
|
||
|
create_collection_name("default", "invalid.name")
|
||
|
|
||
|
|
||
|
def test_create_collection_name_invalid_embedding_does_not_throw():
|
||
|
collection = create_collection_name("default", "invalid.name", validate=False)
|
||
|
assert collection == "default-invalid-name"
|