Skip to content

ModFileSpec completeness #26

@jojoelfe

Description

@jojoelfe

I tried to create a test that checks if reading a .mod file and writing it again results in equal files.

def test_read_write_read_rountrip(two_contour_model_file, tmp_path):
    """Check that reading and writing a model file results in the same data."""
    model = ImodModel.from_file(two_contour_model_file)
    model.to_file(tmp_path / "test_model.imod")
    # Compare checksums of the two files
    with open(two_contour_model_file, 'rb') as file:
        checksum1 = sum(bytearray(file.read()))
    with open(tmp_path / "test_model.imod", 'rb') as file:
        checksum2 = sum(bytearray(file.read()))
    assert checksum1 == checksum2

It does not.

>       assert checksum1 == checksum2
E       assert 46306 == 34925

tests/test_model_api.py:89: AssertionError

So there are probably parts of the ModFileSpec that are incomplete. Probably not a huge issue, but something to keep in mind.

Metadata

Metadata

Assignees

No one assigned

    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