當前位置: 首頁>>代碼示例>>Python>>正文


Python DescriptorElementFactory.new_descriptor方法代碼示例

本文整理匯總了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)
開發者ID:kod3r,項目名稱:SMQTK,代碼行數:18,代碼來源:test_DescriptorElementFactory.py

示例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)
開發者ID:dhandeo,項目名稱:SMQTK,代碼行數:20,代碼來源:test_DescriptorElementFactory.py

示例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)
開發者ID:kod3r,項目名稱:SMQTK,代碼行數:22,代碼來源:test_DescriptorElementFactory.py

示例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)
開發者ID:dhandeo,項目名稱:SMQTK,代碼行數:23,代碼來源:test_DescriptorElementFactory.py


注:本文中的smqtk.representation.DescriptorElementFactory.new_descriptor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。