本文整理汇总了Python中mock.PropertyMock.assert_not_called方法的典型用法代码示例。如果您正苦于以下问题:Python PropertyMock.assert_not_called方法的具体用法?Python PropertyMock.assert_not_called怎么用?Python PropertyMock.assert_not_called使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mock.PropertyMock
的用法示例。
在下文中一共展示了PropertyMock.assert_not_called方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test__disable_events__specific_names
# 需要导入模块: from mock import PropertyMock [as 别名]
# 或者: from mock.PropertyMock import assert_not_called [as 别名]
def test__disable_events__specific_names(self, mock_events):
"""Test disabling specific events."""
mock_event1 = MagicMock(spec=HoudiniEvent)
mock_enabled1 = PropertyMock(return_value=True)
type(mock_event1).enabled = mock_enabled1
mock_event2 = MagicMock(spec=HoudiniEvent)
mock_enabled2 = PropertyMock(return_value=True)
type(mock_event2).enabled = mock_enabled2
mock_events.return_value = {
mock_event1.name: mock_event1,
mock_event2.name: mock_event2,
}
manager = ht.events.manager.HoudiniEventManager()
manager._event_states = {}
manager._disable_events(names=[mock_event2.name])
# Event 1's enabled property should not have been accessed.
mock_enabled1.assert_not_called()
# Event 2's should have been accessed to get the current value
# and once to disable it.
mock_enabled2.assert_has_calls([call(), call(False)])
self.assertTrue(manager._event_states[mock_event2.name])
self.assertEqual(len(manager._event_states), 1)