derwiki-adroll / mock

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

Mock constructor should accept Iterables for spec and spec_set keyword arguments #106

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a Mock instance using a tuple for spec or spec_set
2. Call one of the methods specified in the spec or spec_set
3. All method calls raise instances of AttributeError

What is the expected output? What do you see instead?
Calling methods corresponding to the strings specified in spec or spec_set 
should not raise AttributeError.

What version of the product are you using? On what operating system?
Mock 0.7.2 on CPython 2.7.2, Mac OS X 10.6.8.

Please provide any additional information below.
Instead of accepting only instances of list (and any subclasses thereof), the 
constructor code should also accept immutable sequences - such as tuples - or 
more generally, a collections.Iterable of any class.

Original issue reported on code.google.com by hkukr...@unata.com on 20 Jul 2011 at 2:37

GoogleCodeExporter commented 9 years ago
The change you suggest would prevent you using an iterable object as a spec. I 
agree that tuples should be allowed though.

Original comment by fuzzyman on 20 Jul 2011 at 2:49

GoogleCodeExporter commented 9 years ago

Original comment by fuzzyman on 20 Jul 2011 at 2:50

GoogleCodeExporter commented 9 years ago
Changed on head (will be in 0.8 alpha 3), tuples as well as lists allowed for 
providing a spec.

Original comment by fuzzyman on 23 Jul 2011 at 12:54