Spaces:
Running
Running
File size: 1,013 Bytes
cb5b71d 73ebcab cb5b71d 73ebcab cb5b71d 73ebcab cb5b71d 73ebcab cb5b71d 73ebcab cb5b71d 73ebcab cb5b71d 1b94fec |
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 30 31 32 33 |
from core.state import Field
import mlcroissant as mlc
from views.record_sets import _find_joins
def test_find_joins():
fields = [
Field(
id="field1",
name="field1",
source=mlc.Source(
file_object="some_csv", extract=mlc.Extract(column="some_column")
),
references=mlc.Source(field="some_record_set/some_field"),
),
Field(id="field2", name="field2", source=mlc.Source(field="foo/bar")),
Field(
id="field3",
name="field3",
source=mlc.Source(field="some_record_set/some_field"),
references=mlc.Source(field="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"),
),
]
)
|