[New-bugs-announce] [issue13387] add exact_type argument to assertIsInstance

Florent Xicluna report at bugs.python.org
Sat Nov 12 13:43:22 CET 2011

New submission from Florent Xicluna <florent.xicluna at gmail.com>:

Sometimes we want to check the exact type of an object.
The method assertIsInstance could be misleading in such case.

The current workaround is:
assertIs(type(obj), some_class)

However we can add an argument to the method to keep the benefit of  having a nice failure message.

  assertIsInstance(stdobj, dict, exact_type=True)
  assertIsInstance(myobj, dict, exact_type=MyDict)

components: Tests
messages: 147480
nosy: flox, georg.brandl, michael.foord
priority: normal
severity: normal
status: open
title: add exact_type argument to assertIsInstance
type: feature request
versions: Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list