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

IDEA: add comments to select tests for training purposes #125

Open
truth-quark opened this issue Oct 3, 2024 · 0 comments
Open

IDEA: add comments to select tests for training purposes #125

truth-quark opened this issue Oct 3, 2024 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@truth-quark
Copy link
Collaborator

Following skillshare, it's apparent the setup approach & intent of tests is less obvious to project newcomers (& those new to mock). One question asked about why the tests used these mocks:

mock.patch("mule.load_umfile"),
mock.patch("umpost.um2netcdf.process_mule_vars") as m_mule_vars,

Which cover this code:

ff = mule.load_umfile(str(infile))
mv = process_mule_vars(ff)

The 2 mock shortcut makes load_umfile() do nothing & simulates process_mule_vars() returning data. An alternative is mocking load_umfile() to return a mock mule object that can be "opened" in process_mule_vars() & return data values. That's clearly more complex than the current approach.

Therefore, it's potentially worth over documenting a couple of tests to provide training hints.

Downsides:

  • Once mule calls are extracted & process() takes data structure args, mocking isn't required.
  • The comments "rot"...
@truth-quark truth-quark added the documentation Improvements or additions to documentation label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant