Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModFileSpec completeness #26

Open
jojoelfe opened this issue Dec 11, 2024 · 1 comment
Open

ModFileSpec completeness #26

jojoelfe opened this issue Dec 11, 2024 · 1 comment

Comments

@jojoelfe
Copy link
Collaborator

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.

@alisterburt
Copy link
Collaborator

Huh, good to know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants