Skip to content

Commit 7fc176c

Browse files
committed
Update extractor tests
1 parent 3c90c41 commit 7fc176c

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

libs/langchain/tests/unit_tests/test_gliner_link_extractor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
from langchain_core.graph_vectorstores import Link
12
from ragstack_langchain.graph_store.extractors import GLiNERLinkExtractor
2-
from ragstack_langchain.graph_store.links import Link
33

44
PAGE_1 = """
55
Cristiano Ronaldo dos Santos Aveiro (Portuguese pronunciation: [kɾiʃ'tjɐnu

libs/langchain/tests/unit_tests/test_hierarchy_link_extractor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
from langchain_core.graph_vectorstores import Link
12
from ragstack_langchain.graph_store.extractors import HierarchyLinkExtractor
2-
from ragstack_langchain.graph_store.links import Link
33

44
PATH_1 = ["Root", "H1", "h2"]
55

libs/langchain/tests/unit_tests/test_html_link_extractor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from bs4 import BeautifulSoup
2+
from langchain_core.graph_vectorstores import Link
23
from ragstack_langchain.graph_store.extractors import HtmlInput, HtmlLinkExtractor
3-
from ragstack_langchain.graph_store.links import Link
44

55
PAGE_1 = """
66
<html>

libs/langchain/tests/unit_tests/test_keybert_link_extractor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
from langchain_core.graph_vectorstores import Link
12
from ragstack_langchain.graph_store.extractors import KeybertLinkExtractor
2-
from ragstack_langchain.graph_store.links import Link
33

44
PAGE_1 = """
55
Supervised learning is the machine learning task of learning a function that

libs/langchain/tests/unit_tests/test_link_extractor_transformer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from langchain_core.documents import Document
2+
from langchain_core.graph_vectorstores.links import Link, get_links
23
from ragstack_langchain.graph_store.extractors import (
34
HtmlLinkExtractor,
45
LinkExtractorTransformer,
@@ -9,7 +10,6 @@
910
from ragstack_langchain.graph_store.extractors.keybert_link_extractor import (
1011
KeybertLinkExtractor,
1112
)
12-
from ragstack_langchain.graph_store.links import Link, get_links
1313

1414
from . import (
1515
test_gliner_link_extractor,
@@ -40,15 +40,15 @@ def test_html_extractor():
4040
assert results[0] == doc1
4141
assert results[1] == doc2
4242

43-
assert get_links(doc1) == {
43+
assert set(get_links(doc1)) == {
4444
Link.incoming(kind="hyperlink", tag="https://foo.com/bar/"),
4545
Link.outgoing(kind="hyperlink", tag="https://foo.com/bar/relative"),
4646
Link.outgoing(kind="hyperlink", tag="https://foo.com/relative-base"),
4747
Link.outgoing(kind="hyperlink", tag="http://cnn.com"),
4848
Link.outgoing(kind="hyperlink", tag="https://same.foo"),
4949
}
5050

51-
assert get_links(doc2) == {
51+
assert set(get_links(doc2)) == {
5252
Link.incoming(kind="hyperlink", tag="https://foo.com/baz/"),
5353
Link.outgoing(kind="hyperlink", tag="https://foo.com/bar/"),
5454
}
@@ -71,15 +71,15 @@ def test_multiple_extractors():
7171
assert results[0] == doc1
7272
assert results[1] == doc2
7373

74-
assert get_links(doc1) == {
74+
assert set(get_links(doc1)) == {
7575
Link(kind="kw", direction="bidir", tag="labeled"),
7676
Link(kind="kw", direction="bidir", tag="learning"),
7777
Link(kind="kw", direction="bidir", tag="training"),
7878
Link(kind="kw", direction="bidir", tag="supervised"),
7979
Link(kind="kw", direction="bidir", tag="labels"),
8080
}
8181

82-
assert get_links(doc2) == {
82+
assert set(get_links(doc2)) == {
8383
Link(kind="kw", direction="bidir", tag="cristiano"),
8484
Link(kind="kw", direction="bidir", tag="goalscorer"),
8585
Link(kind="kw", direction="bidir", tag="footballer"),

0 commit comments

Comments
 (0)