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

Function TestCSVLoader

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

Source from the content-addressed store, hash-verified

10)
11
12func TestCSVLoader(t *testing.T) {
13 t.Parallel()
14 file, err := os.Open("./testdata/test.csv")
15 require.NoError(t, err)
16
17 loader := NewCSV(file)
18
19 ctx := context.Background()
20 docs, err := loader.Load(ctx)
21 require.NoError(t, err)
22 require.Len(t, docs, 20)
23
24 expected1 := "name: John Doe\nage: 25\ncity: New York\ncountry: United States"
25 assert.Equal(t, docs[0].PageContent, expected1)
26
27 expected2 := `name: Jane Smith
28age: 32
29city: London
30country: United Kingdom`
31 assert.Equal(t, docs[1].PageContent, expected2)
32}
33
34func TestCSVLoaderWithFilteringColumns(t *testing.T) {
35 t.Parallel()

Callers

nothing calls this directly

Calls 2

LoadMethod · 0.95
NewCSVFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…