-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Closed
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
from unittest.mock import Mock, seal
class Foo:
pass
class Bar[T]:
pass
for cls in [Foo, Bar]:
print(cls.__name__, "unsealed:", isinstance(Mock(cls), cls))
m = Mock(cls)
seal(m)
print(cls.__name__, "sealed:", isinstance(m, Foo))
With both Python 3.12.7 and 3.13.7 this prints
Foo unsealed: True
Foo sealed: True
Bar unsealed: True
Bar sealed: False
I would have expected that sealing a mock does not change its behavior w.r.t. isinstance
.
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error