derwiki-adroll / mock

Automatically exported from code.google.com/p/mock
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Providing ability to assert calls by type rather than by value if necessary #202

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
For some tests it becomes impractical to assert calls by type. The attached 
patch provides a TypeMock and a more Pythonic looking is_a function, that can 
be used like so;

    mock_function(1, 2, 3, {}, set(), (1,2,), [1, 2, 3])
    mock_function.assert_called_with(1, 2, 3, is_a(dict), is_a(set), is_a(tuple), is_a(list))

Original issue reported on code.google.com by nat...@getoffmalawn.com on 5 Apr 2013 at 5:42

Attachments:

GoogleCodeExporter commented 9 years ago
Meta note: I can't find any way in the web interface to mark this as an 
enhancement instead of a defect.

Original comment by nat...@getoffmalawn.com on 5 Apr 2013 at 5:43