Module trase.tools.data_release_package.validate.test.test_cli

Functions

def test_country_of_production_must_match_the_context(tmp_path, monkeypatch)
def test_country_of_production_that_is_null_in_some_rows_fails(tmp_path, monkeypatch)
def test_data_files_with_rows_pass(tmp_path, monkeypatch)

The checks that read S3, with the reads themselves stubbed out.

def test_empty_data_file_fails(tmp_path, monkeypatch)
def test_errors_when_path_is_not_a_directory(tmp_path)
def test_full_package_passes(tmp_path)
def test_metadata_must_be_a_json_array(tmp_path)
def test_minimal_package_passes(tmp_path)
def test_missing_required_file_fails(tmp_path)
def test_no_validation_reaches_s3_by_default(tmp_path)

The suite must stay local: nothing here should need AWS credentials.

def test_null_level_in_a_spatial_layer_fails(tmp_path, monkeypatch)

level orders the layers of a package, so no row may be without one.

def test_one_node_type_at_two_levels_fails(tmp_path, monkeypatch)

The check spans the layers: a node type sits at one level per country.

def test_one_node_type_at_two_levels_in_different_countries_passes(tmp_path, monkeypatch)

level is scoped to a country: region may be 2 in one and 3 in another.

def test_only_and_skip_are_respected(tmp_path)
def test_package_without_a_methodology_passes(tmp_path)

documentation/methodology.md is optional, so a package may omit it.

def test_pointer_file_must_be_a_single_s3_url(tmp_path)
def test_pointer_requires_its_paired_metadata(tmp_path)
def test_skip_s3_leaves_out_marked_validations(tmp_path, monkeypatch)
def test_skip_s3_still_runs_the_local_validations(tmp_path, monkeypatch)
def test_spatial_layer_without_a_level_column_fails(tmp_path, monkeypatch)

A layer without a level column at all reads as a failure, not a pass.

def test_spatial_layer_without_the_country_of_production_fails(tmp_path, monkeypatch)

A layer built before the columns existed, or one that simply left them out.

def test_the_same_node_type_at_one_level_across_layers_passes(tmp_path, monkeypatch)

Splitting one node type over several layers is allowed; disagreeing is not.

def test_unexpected_top_level_entry_fails(tmp_path)
def test_unreadable_data_file_fails(tmp_path, monkeypatch)