Exact input matching

Positional arguments and defaults are bound to the function signature before comparison, so callers can use the function naturally.

python
import niltest
from niltest import Mode

niltest.configure(mode=Mode.MOCK)  # @scenarioより前
from your_package.shipping import shipping_fee

result = shipping_fee(1_000, premium=True)
assert result == 0

Fall through to the implementation

If no fixed case matches, the real function runs normally. This makes gradual, partial stubbing possible.

Expectations that cannot act as mocks

  • A type-only expectation has no concrete value to return
  • A validator callable describes a condition, not a concrete value
  • Use a dedicated mocking library when the side effect itself is under test