Skip to content

feat(snapshots): add snapshot fixtures, remove pandas fixture#151

Merged
wpbonelli merged 7 commits into
MODFLOW-ORG:developfrom
wpbonelli:snapshots
May 13, 2024
Merged

feat(snapshots): add snapshot fixtures, remove pandas fixture#151
wpbonelli merged 7 commits into
MODFLOW-ORG:developfrom
wpbonelli:snapshots

Conversation

@wpbonelli
Copy link
Copy Markdown
Member

@wpbonelli wpbonelli commented May 7, 2024

  • add numpy array snapshot extensions and fixtures with syrupy, moved from flopy
  • remove use_pandas fixture, originally meant for use in flopy tests for pandas support but never used and probably not needed, as flopy use_pandas flags will be removed eventually

@wpbonelli wpbonelli marked this pull request as ready for review May 7, 2024 13:43
@wpbonelli wpbonelli requested a review from mwtoews May 7, 2024 13:44
@wpbonelli
Copy link
Copy Markdown
Member Author

@mwtoews I was mainly wondering what you thought of the optional import decision here. But I think it's probably best to keep using import_optional_dependency(), will update to do so unless you disagree

@mwtoews
Copy link
Copy Markdown
Collaborator

mwtoews commented May 9, 2024

@wpbonelli no strong opinions so far, I'm just finding time to look further at the methods. One further idea is to also support compressed array ".npz" using numpy.savez_compressed.

@wpbonelli
Copy link
Copy Markdown
Member Author

Thanks @mwtoews for the suggestion, savez_compressed() also allows snapshots of multiple arrays at once. I pushed a commit drafting support for multiple arrays e.g.

def my_test(multi_array_snapshot):
    ...
    arrays = {
        "head": ...
        "budget": ...
    }
    assert arrays == multi_array_snapshot

which is consistent with np.load() returning a dict for multi-array .npz files.

@wpbonelli
Copy link
Copy Markdown
Member Author

Looks like with npz files we get inconsistent binary encodings. Strange that it's only npz files and not npy files.

@wpbonelli
Copy link
Copy Markdown
Member Author

I will merge as-is so we can use this for PRT tests, but would be ideal to support snapshots of multiple arrays eventually.

@wpbonelli wpbonelli merged commit c9e445d into MODFLOW-ORG:develop May 13, 2024
@wpbonelli wpbonelli deleted the snapshots branch May 13, 2024 17:11
This was referenced May 15, 2024
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

Successfully merging this pull request may close these issues.

2 participants