File size: 896 Bytes
cb5b71d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from core.state import Field
import mlcroissant as mlc
from views.record_sets import _find_joins


def test_find_joins():
    fields = [
        Field(
            name="field1",
            source=mlc.Source(
                uid="some_csv", extract=mlc.Extract(column="some_column")
            ),
            references=mlc.Source(uid="some_record_set/some_field"),
        ),
        Field(name="field2", source=mlc.Source(uid="foo/bar")),
        Field(
            name="field3",
            source=mlc.Source(uid="some_record_set/some_field"),
            references=mlc.Source(uid="some_other_record_set/some_other_field"),
        ),
    ]
    assert _find_joins(fields) == set([
        (("some_csv", "some_column"), ("some_record_set", "some_field")),
        (
            ("some_record_set", "some_field"),
            ("some_other_record_set", "some_other_field"),
        ),
    ])