mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-16 06:53:16 +00:00
Add Mastodon toots loader (#5036)
# Add Mastodon toots loader. Loader works either with public toots, or Mastodon app credentials. Toot text and user info is loaded. I've also added integration test for this new loader as it works with public data, and a notebook with example output run now. --------- Co-authored-by: Dev 2049 <dev.dev2049@gmail.com>
This commit is contained in:
14
tests/integration_tests/document_loaders/test_mastodon.py
Normal file
14
tests/integration_tests/document_loaders/test_mastodon.py
Normal file
@@ -0,0 +1,14 @@
|
||||
"""Tests for the Mastodon toots loader"""
|
||||
from langchain.document_loaders import MastodonTootsLoader
|
||||
|
||||
|
||||
def test_mastodon_toots_loader() -> None:
|
||||
"""Test Mastodon toots loader with an external query."""
|
||||
# Query the Mastodon CEO's account
|
||||
loader = MastodonTootsLoader(
|
||||
mastodon_accounts=["@Gargron@mastodon.social"], number_toots=1
|
||||
)
|
||||
docs = loader.load()
|
||||
|
||||
assert len(docs) == 1
|
||||
assert docs[0].metadata["user_info"]["id"] == 1
|
@@ -86,6 +86,7 @@ def test_create_directory_and_files(tmp_path: Path) -> None:
|
||||
assert output == "file1.txt\nfile2.txt"
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="flaky on GHA, TODO to fix")
|
||||
@pytest.mark.skipif(
|
||||
sys.platform.startswith("win"), reason="Test not supported on Windows"
|
||||
)
|
||||
|
Reference in New Issue
Block a user