MCPcopy Create free account
hub / github.com/tmc/langchaingo / TestTextLoader

Function TestTextLoader

documentloaders/text_test.go:12–29  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestTextLoader(t *testing.T) {
13 ctx := context.Background()
14 t.Parallel()
15 file, err := os.Open("./testdata/test.txt")
16 require.NoError(t, err)
17
18 loader := NewText(file)
19
20 docs, err := loader.Load(ctx)
21 require.NoError(t, err)
22 require.Len(t, docs, 1)
23
24 expectedPageContent := "Foo Bar Baz"
25 assert.Equal(t, expectedPageContent, docs[0].PageContent)
26
27 expectedMetadata := map[string]any{}
28 assert.Equal(t, expectedMetadata, docs[0].Metadata)
29}

Callers

nothing calls this directly

Calls 2

LoadMethod · 0.95
NewTextFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…