Skip to content

[Bug] Data validation ignores bad values for unit_commitment_method #1321

@abelsiqueira

Description

@abelsiqueira

Description

Discovered in #1318.
Validation is not picking up values of unit_commitment_method outside of the schemas' oneOf constraints.
In other words, the _validate_schema_one_of_constraints! functions needs more tests.

Package Version

latest

Julia Version

NA

Reproduction steps

This new test should pass:

@testitem "Test schema oneOf constraints - bad unit commitment method" setup = [CommonSetup] tags =
    [:unit, :data_validation, :fast] begin
    connection = _tiny_fixture()
    # Change the table to force an error
    DuckDB.query(
        connection,
        "UPDATE asset SET unit_commitment_method = 'bad' WHERE asset = 'demand'",
    )
    @test_throws TEM.DataValidationException TEM.create_internal_tables!(connection)
    error_messages = TEM._validate_schema_one_of_constraints!(connection)
    @test error_messages ==
          ["Table 'asset' has bad value for column 'unit_commitment_method': 'bad'"]
end

Relevant log output

Operating System

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions