Add functions for checking if a spy was called only once.

Review Request #14621 — Created Sept. 19, 2025 and updated — Latest diff uploaded

Information

kgb
master

Reviewers

kgb

A common pattern when using kgb is to check if a spy was called only
once, and sometimes once with specific arguments. Callers had to do this
by checking the call count and then checking the arguments, or to use a
spy operation that would fail if executed more than once.

This introduce two new functions to perform these checks in a simpler
manner:

  • assertSpyCalledOnce()
  • assertSpyCalledOnceWith()

There are also pytest equivalent functions for both.

All unit tests pass on all environments.

Commits

Files