Add more flexible argument checking in called_with().

Review Request #9523 — Created Jan. 23, 2018 and submitted

Information

kgb
master
72eaa5e...

Reviewers

kgb

A recent change had to alter how arguments were stored when calling a
spy, due to opcode changes in Python 3.6. Arguments in a call were
stored as positional or keyword arguments based on the function
signature and not on the call itself. That made some usage of kgb a bit
less than ideal, because instead of descriptive called_with() checks
using keyword arguments (matching descriptive calls), they'd have to
become less-descriptive calls specifying positional arguments.

This change enables passing keyword arguments to called_with() and
last_called_with() to check positional arguemnts. Instead of just
checking the list of keyword arguments in the signature, the entire list
of arguments are checked instead. This can help future-proof unit tests,
and just makes things more readable.

Unit tests pass on Python 2.7, 3.4, 3.5, and 3.6.

Tested with the other main codebases we use.

david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (65c487b)
Loading...