Skip to content

Overhaul of the regression testing module#11

Open
avadean wants to merge 1 commit intomainfrom
regression
Open

Overhaul of the regression testing module#11
avadean wants to merge 1 commit intomainfrom
regression

Conversation

@avadean
Copy link
Collaborator

@avadean avadean commented Feb 13, 2026

Overhaul of the regression testing module

  • Introduction gives motivation and explanation
  • Manual example
  • Snaptol example
  • Snaptol with floating point number tolerance example
  • 3 exercises of increasing difficulty

…testing via an example of a manual test to illustrate the idea and the fallbacks of doing it manually. Then introduces Snaptol to automate the file management process, as well as introduce the capability of tolerances on comparisons involving floating point numbers. Introduce 3 exercises of increasing difficulty, along with solutions.
@github-actions
Copy link

github-actions bot commented Feb 13, 2026

Thank you!

Thank you for your pull request 😃

🤖 This automated message can help you check the rendered files in your submission for clarity. If you have any questions, please feel free to open an issue in {sandpaper}.

If you have files that automatically render output (e.g. R Markdown), then you should check for the following:

  • 🎯 correct output
  • 🖼️ correct figures
  • ❓ new warnings
  • ‼️ new errors

Rendered Changes

🔍 Inspect the changes: https://github.com/ResearchCodingClub/python-testing-for-research/compare/md-outputs..md-outputs-PR-11

The following changes were observed in the rendered markdown documents:

 09-testing-output-files.md | 467 ++++++++++++++++++++++++++++++++-------------
 md5sum.txt                 |  42 ++--
 setup.md                   |   2 +-
 3 files changed, 361 insertions(+), 150 deletions(-)
What does this mean?

If you have source files that require output and figures to be generated (e.g. R Markdown), then it is important to make sure the generated figures and output are reproducible.

This output provides a way for you to inspect the output in a diff-friendly manner so that it's easy to see the changes that occur due to new software versions or randomisation.

⏱️ Updated at 2026-02-13 18:23:22 +0000

github-actions bot pushed a commit that referenced this pull request Feb 13, 2026
Copy link
Collaborator

@LiamPattinson LiamPattinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @avadean! Just leaving a few comments for now, as I'll be working on a bunch of my own material over the weekend which will inform the final review. I'm close to finishing a lesson on floating point numbers which might help simplify some of the content here.

```bash
pip install pytest-regtest
```
It is good practice to add these types of tests to all projects. They are particularly useful,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd maybe soften the argument here, and just stick with the concrete reasons they're a good idea

Suggested change
It is good practice to add these types of tests to all projects. They are particularly useful,
They are particularly useful,

not have an exact answer but can be approximated numerically within a given tolerance. This, along with the common use
of controlled randomised initial conditions, can lead to results that differ slightly between runs.

In the example below, we approximate the value of pi using a random sample of points in a square. The exact
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been working on an earlier section that introduces testing floating point numbers with tolerances, and by chance I've used the exact same algorithm to demonstrate it. It might be worth rewriting this section to reuse the code from my section after I've raised my own PR.


```bash
pip install numpy pandas matplotlib pytest pytest-regtest pytest-mpl
pip install numpy pandas matplotlib pytest pytest-regtest pytest-mpl snaptol
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove pytest-regtest and pytest-mpl here?

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