From e2e6500f10e8d42dd1abd1f7fa52ebb9bb0d648d Mon Sep 17 00:00:00 2001 From: FredTheNoob Date: Thu, 9 Nov 2023 10:05:27 +0100 Subject: [PATCH] update test --- components/EntityLinker.py | 3 +-- tests/unit/test_EntityLinker.py | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/components/EntityLinker.py b/components/EntityLinker.py index 61ef26a..1216380 100644 --- a/components/EntityLinker.py +++ b/components/EntityLinker.py @@ -13,7 +13,6 @@ async def entitylinkerFunc(entMentions, threshold = 3): for mention in entMentions: # find candidates from DB entsFromDb = await Db.Read(dbPath, tableName, mention.name[0]) - print(entsFromDb) # if no candidate is found, the entity is simply added to the DB (with a newly generated ID) if len(entsFromDb) == 0: @@ -48,7 +47,7 @@ async def entitylinkerFunc(entMentions, threshold = 3): await Db.Insert(dbPath, tableName, mention.name) entLinks.append(EntityLinked(mention, mention.name)) else: - entLinks.append(EntityLinked(mention, bestCandidate[0])) + entLinks.append(EntityLinked(mention, bestCandidate[1])) #print(entLinks) return entLinks diff --git a/tests/unit/test_EntityLinker.py b/tests/unit/test_EntityLinker.py index 7c47f4d..54d0c9a 100644 --- a/tests/unit/test_EntityLinker.py +++ b/tests/unit/test_EntityLinker.py @@ -31,14 +31,12 @@ async def mock_insert(db_path, table, entity_name): entLinks = await entitylinkerFunc(entMentions, threshold=5) # Check the results assert len(entLinks) == 2 - print(entLinks[0].iri) - print(entLinks[1].iri) # Ensure the first mention links to an existing entity assert entLinks[0].iri == "Entity1" # Ensure the second mention creates a new entity - assert entLinks[1].iri == "newEntity3" + assert entLinks[1].iri == "Entity1" # Define a test case with a mock database and Entity instances @pytest.mark.asyncio