
What happened
Using a small Python function where fee became keyword-only, a fix that removes the * from the definition is compared with one that updates the call to total(100, fee=5); both return 105 when tests check only the value.
Why it matters
A value-only test cannot distinguish the two fixes, so accepting a change on a green test alone may silently drop the calling convention the change was meant to enforce.
Summaries like this, every morning.
A deliberately small Python function, total(amount, *, fee=5), is the focus, where the asterisk makes fee keyword-only. An old call, total(100, 5), passes the fee positionally and raises TypeError. Two repairs are offered: one removes the asterisk so the old call works, the other keeps the asterisk and changes the caller to total(100, fee=5). On a value-only check both return 105, so a four-test suite is used to separate them.
The separation depends on what the tests inspect. Two tests call the function and compare return values. A third reads the function's signature with inspect.signature to confirm fee is KEYWORD_ONLY, and a fourth uses assertRaises to confirm total(100, 5) raises TypeError. Under these four, the rollback fix fails the keyword-only and positional-rejection tests, while the caller fix passes all four. Adding a signature-level test is only appropriate when the requirement includes the definition's shape; fixing internal form can restrict changes that should be allowed.
The tutorial then reverses the requirement to keep the old positional call, and the verdict flips to the rollback fix, showing that the same code can be accepted or rejected depending on which calling convention is meant to be preserved. It closes with a one-page review memo template that records the target, requirement, environment, results, and the adopt/reject/hold decision, and it explicitly limits its own validation to the fictional two fixes, three requirements, four tests, and six calls, without claiming general bug-prevention effects from AI.
Pick your industry and the AI tools you use, and get news related to your work every day.
Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →
Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.
Microsoft announced Agent 365, a shared control plane for AI agents spanning Microsoft and non-Microsoft platf…

Visa Crypto Labs head Cuy Sheffield unveiled a new Visa Command Line Interface that verifies an agent using a…

Charles Schwab introduced Charley, a conversational AI assistant built on third-party large language models pl…

Laboro.AI published an article on its official note account titled for engineers who think about what to build…

On the fifth installment of the talk livestream "Ichimon Itto" with actor Shinnosuke Mitsushima, Ichiro Suzuki…

A new online course, AI業務アプリ作成入門講座, is offered for participants in Tokyo and teaches creating work apps by tel…
