本文整理汇总了Python中smqtk.representation.DescriptorElementFactory.new_descriptor方法的典型用法代码示例。如果您正苦于以下问题:Python DescriptorElementFactory.new_descriptor方法的具体用法?Python DescriptorElementFactory.new_descriptor怎么用?Python DescriptorElementFactory.new_descriptor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类smqtk.representation.DescriptorElementFactory
的用法示例。
在下文中一共展示了DescriptorElementFactory.new_descriptor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_no_params
# 需要导入模块: from smqtk.representation import DescriptorElementFactory [as 别名]
# 或者: from smqtk.representation.DescriptorElementFactory import new_descriptor [as 别名]
def test_no_params(self, dei_init):
# So we don't break python
dei_init.return_value = None
test_params = {}
factory = DescriptorElementFactory(DummyElementImpl, test_params)
expected_type = 'type'
expected_uuid = 'uuid'
# Should construct a new DEI instance under they hood somewhere
r = factory.new_descriptor(expected_type, expected_uuid)
ntools.assert_true(dei_init.called)
dei_init.assert_called_once_with(expected_type, expected_uuid)
ntools.assert_is_instance(r, DummyElementImpl)
示例2: test_no_params
# 需要导入模块: from smqtk.representation import DescriptorElementFactory [as 别名]
# 或者: from smqtk.representation.DescriptorElementFactory import new_descriptor [as 别名]
def test_no_params(self):
test_params = {}
factory = DescriptorElementFactory(DummyElementImpl, test_params)
expected_type = 'type'
expected_uuid = 'uuid'
expected_args = ()
expected_kwds = {}
# Should construct a new DEI instance under they hood somewhere
r = factory.new_descriptor(expected_type, expected_uuid)
ntools.assert_is_instance(r, DummyElementImpl)
ntools.assert_equal(r._type_label, expected_type)
ntools.assert_equal(r._uuid, expected_uuid)
ntools.assert_equal(r.args, expected_args)
ntools.assert_equal(r.kwds, expected_kwds)
示例3: test_with_params
# 需要导入模块: from smqtk.representation import DescriptorElementFactory [as 别名]
# 或者: from smqtk.representation.DescriptorElementFactory import new_descriptor [as 别名]
def test_with_params(self, dei_init):
# So we don't break python
dei_init.return_value = None
v = numpy.random.randint(0, 10, 10)
test_params = {
'p1': 'some dir',
'vec': v
}
factory = DescriptorElementFactory(DummyElementImpl, test_params)
ex_type = 'type'
ex_uuid = 'uuid'
# Should construct a new DEI instance under they hood somewhere
r = factory.new_descriptor(ex_type, ex_uuid)
ntools.assert_true(dei_init.called)
dei_init.assert_called_once_with(ex_type, ex_uuid, p1='some dir', vec=v)
ntools.assert_is_instance(r, DummyElementImpl)
示例4: test_with_params
# 需要导入模块: from smqtk.representation import DescriptorElementFactory [as 别名]
# 或者: from smqtk.representation.DescriptorElementFactory import new_descriptor [as 别名]
def test_with_params(self):
v = numpy.random.randint(0, 10, 10)
test_params = {
'p1': 'some dir',
'vec': v
}
factory = DescriptorElementFactory(DummyElementImpl, test_params)
ex_type = 'type'
ex_uuid = 'uuid'
ex_args = ()
ex_kwds = test_params
# Should construct a new DEI instance under they hood somewhere
r = factory.new_descriptor(ex_type, ex_uuid)
ntools.assert_is_instance(r, DummyElementImpl)
ntools.assert_equal(r._type_label, ex_type)
ntools.assert_equal(r._uuid, ex_uuid)
ntools.assert_equal(r.args, ex_args)
ntools.assert_equal(r.kwds, ex_kwds)