擅长:python、mysql、java
<p>你可以在这里找到更多信息:<a href="http://www.voidspace.org.uk/downloads/mock-1.0.1.pdf" rel="nofollow">http://www.voidspace.org.uk/downloads/mock-1.0.1.pdf</a></p>
<blockquote>
<p>• spec: This can be either a list of strings or an existing object (a class or instance) that acts as the specification for the mock object. If you pass in an object then a list of strings is formed by calling dir on the object (excluding unsupported magic attributes and methods). Accessing any attribute not in this list will raise an AttributeError. If spec is an object (rather than a list of strings) then <strong>class</strong> returns the class of the spec object. This allows mocks to pass isinstance tests.</p>
<p>• spec_set: A stricter variant of spec. If used, attempting to set or get an attribute on the mock that isn’t on the object passed as spec_set will raise an AttributeError.</p>
</blockquote>