本文整理汇总了Python中mantid.api.FunctionFactory.unsubscribe方法的典型用法代码示例。如果您正苦于以下问题:Python FunctionFactory.unsubscribe方法的具体用法?Python FunctionFactory.unsubscribe怎么用?Python FunctionFactory.unsubscribe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mantid.api.FunctionFactory
的用法示例。
在下文中一共展示了FunctionFactory.unsubscribe方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_function_existing_function_can_be_unsubscribed
# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import unsubscribe [as 别名]
def test_function_existing_function_can_be_unsubscribed(self):
FunctionFactory.subscribe(TestFunctionCorrectForm)
nfuncs_before = len(FunctionFactory.getFunctionNames())
FunctionFactory.unsubscribe("TestFunctionCorrectForm")
available_functions = FunctionFactory.getFunctionNames()
self.assertEquals(nfuncs_before - 1, len(available_functions))
self.assertTrue("TestFunctionCorrectForm" not in available_functions)
示例2: test_function_subscription
# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import unsubscribe [as 别名]
def test_function_subscription(self):
nfuncs_orig = len(FunctionFactory.getFunctionNames())
FunctionFactory.subscribe(TestFunction)
new_funcs = FunctionFactory.getFunctionNames()
self.assertEquals(nfuncs_orig+1, len(new_funcs))
self.assertTrue("TestFunction" in new_funcs)
FunctionFactory.unsubscribe("TestFunction")
new_funcs = FunctionFactory.getFunctionNames()
self.assertEquals(nfuncs_orig, len(new_funcs))
self.assertTrue("TestFunction" not in new_funcs)
示例3: test_category_override_returns_overridden_result
# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import unsubscribe [as 别名]
def test_category_override_returns_overridden_result(self):
FunctionFactory.subscribe(Times2)
func = FunctionFactory.createFunction("Times2")
self.assertEquals("SimpleFunction", func.category())
FunctionFactory.unsubscribe("Times2")
示例4: test_category_with_no_override_returns_default_category
# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import unsubscribe [as 别名]
def test_category_with_no_override_returns_default_category(self):
FunctionFactory.subscribe(NoCatgeoryFunction)
func = FunctionFactory.createFunction("NoCatgeoryFunction")
self.assertEquals("General", func.category())
FunctionFactory.unsubscribe("NoCatgeoryFunction")
示例5: test_instance_can_be_created_from_factory
# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import unsubscribe [as 别名]
def test_instance_can_be_created_from_factory(self):
FunctionFactory.subscribe(Times2)
func_name = Times2.__name__
func = FunctionFactory.createFunction(func_name)
self.assertTrue(isinstance(func, IFunction1D))
FunctionFactory.unsubscribe(func_name)