File size: 1,129 Bytes
2e511b5 | 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 34 35 36 37 38 39 40 41 | """Harvey ingest: folder normalization and export-layout detection."""
import pytest
from legex.harvey import _folder_to_cc, _value_columns
# Old and new export names
@pytest.mark.parametrize(
"folder,cc",
[
("Hong_Kong", "hk"),
("Hong Kong (new)", "hk"),
("Brazil (new)", "br"),
("Korea (new)", "kr"),
("Kosovo (new)", "xk"),
("Serbia (new)", "rs"),
("Schweiz_final", "ch"),
("Switzerland", "ch"),
("Atlantis", None),
],
)
def test_folder_to_cc(folder, cc):
assert _folder_to_cc(folder) == cc
def test_value_columns_new_layout():
# 3 meta cols + 12 questions x 2 (Answer/Citations) = 27
m = _value_columns(27)
assert m[5] == "legal_subject_judgement"
assert m[7] == "trial_start_date"
assert m[25] == "defendant_no1_ISIC1_industry_category"
assert 3 not in m
def test_value_columns_old_layout():
# 3 meta cols + 12 questions x 4 = 51
m = _value_columns(51)
assert m[7] == "legal_subject_judgement"
assert m[11] == "trial_start_date"
assert m[47] == "defendant_no1_ISIC1_industry_category"
|