本文整理汇总了Python中sqla_plugin_base.want_method方法的典型用法代码示例。如果您正苦于以下问题:Python sqla_plugin_base.want_method方法的具体用法?Python sqla_plugin_base.want_method怎么用?Python sqla_plugin_base.want_method使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sqla_plugin_base
的用法示例。
在下文中一共展示了sqla_plugin_base.want_method方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: wantMethod
# 需要导入模块: import sqla_plugin_base [as 别名]
# 或者: from sqla_plugin_base import want_method [as 别名]
def wantMethod(self, fn):
if py3k:
if not hasattr(fn.__self__, 'cls'):
return False
cls = fn.__self__.cls
else:
cls = fn.im_class
return plugin_base.want_method(cls, fn)
示例2: pytest_pycollect_makeitem
# 需要导入模块: import sqla_plugin_base [as 别名]
# 或者: from sqla_plugin_base import want_method [as 别名]
def pytest_pycollect_makeitem(collector, name, obj):
if inspect.isclass(obj) and plugin_base.want_class(obj):
return pytest.Class(name, parent=collector)
elif inspect.isfunction(obj) and \
isinstance(collector, pytest.Instance) and \
plugin_base.want_method(collector.cls, obj):
return pytest.Function(name, parent=collector)
else:
return []
示例3: pytest_pycollect_makeitem
# 需要导入模块: import sqla_plugin_base [as 别名]
# 或者: from sqla_plugin_base import want_method [as 别名]
def pytest_pycollect_makeitem(collector, name, obj):
if inspect.isclass(obj) and plugin_base.want_class(name, obj):
# in pytest 5.4.0
# return [
# pytest.Class.from_parent(collector,
# name=parametrize_cls.__name__)
# for parametrize_cls in _parametrize_cls(collector.module, obj)
# ]
return [
pytest.Class(parametrize_cls.__name__, parent=collector)
for parametrize_cls in _parametrize_cls(collector.module, obj)
]
elif (
inspect.isfunction(obj)
and isinstance(collector, pytest.Instance)
and plugin_base.want_method(collector.cls, obj)
):
# None means, fall back to default logic, which includes
# method-level parametrize
return None
else:
# empty list means skip this item
return []