本文整理匯總了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)