def test_hook_inherited(): class MyLineEdit(QLineEdit): pass widget = MyLineEdit() config = ConfigManager() assert config._get_hook(widget) == QLineEdit
def test_hook_inherited_direct(): class MyLineEdit(QLineEdit): pass widget = MyLineEdit() config = ConfigManager() config.add_hooks(MyLineEdit, (_get_QLineEdit, _set_QLineEdit, _event_QLineEdit)) assert config._get_hook(widget) == MyLineEdit
def test_no_hook(): class MyTestClass: pass o = MyTestClass() config = ConfigManager() with pytest.raises(TypeError) as e: assert config._get_hook(o) assert "No handler-functions available for this" in str(e)
def test_hook_direct(): widget = QLineEdit() config = ConfigManager() assert config._get_hook(widget) == QLineEdit