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


Python ConceptVersion.for_concept方法代碼示例

本文整理匯總了Python中concepts.models.ConceptVersion.for_concept方法的典型用法代碼示例。如果您正苦於以下問題:Python ConceptVersion.for_concept方法的具體用法?Python ConceptVersion.for_concept怎麽用?Python ConceptVersion.for_concept使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在concepts.models.ConceptVersion的用法示例。


在下文中一共展示了ConceptVersion.for_concept方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUp

# 需要導入模塊: from concepts.models import ConceptVersion [as 別名]
# 或者: from concepts.models.ConceptVersion import for_concept [as 別名]
    def setUp(self):
        self.skipTest('Collections and concept references not yet supported.')
        super(ConceptReferenceBaseTest, self).setUp()
        self.concept1 = Concept(
            mnemonic='concept1',
            created_by=self.user1,
            updated_by=self.user1,
            parent=self.source1,
            concept_class='First',
            names=[self.name],
        )
        display_name = LocalizedText(
            name='concept1',
            locale='en'
        )
        self.concept1.names.append(display_name)
        kwargs = {
            'parent_resource': self.source1,
        }
        Concept.persist_new(self.concept1, self.user1, **kwargs)

        self.version1 = ConceptVersion.for_concept(self.concept1, 'version1')
        self.version1.save()

        self.concept2 = Concept(
            mnemonic='concept2',
            created_by=self.user1,
            updated_by=self.user1,
            parent=self.source1,
            concept_class='Second',
            names=[self.name],
        )
        kwargs = {
            'parent_resource': self.source2,
        }
        Concept.persist_new(self.concept2, self.user1, **kwargs)
        self.version2 = ConceptVersion.for_concept(self.concept2, 'version2')
        self.version2.save()
開發者ID:AnjaliWadhwa,項目名稱:oclapi,代碼行數:40,代碼來源:tests.py

示例2: test_for_concept_positive

# 需要導入模塊: from concepts.models import ConceptVersion [as 別名]
# 或者: from concepts.models.ConceptVersion import for_concept [as 別名]
    def test_for_concept_positive(self):
        self.concept1.datatype = 'Boolean'
        self.concept1.save()

        label = 'version1'
        version = ConceptVersion.for_concept(self.concept1, label)

        self.assertEquals(label, version.mnemonic)
        self.assertEquals(self.concept1, version.versioned_object)
        self.assertEquals(self.concept1.concept_class, version.concept_class)
        self.assertEquals(self.concept1.datatype, version.datatype)
        self.assertEquals(self.concept1.names, version.names)
        self.assertEquals(self.concept1.descriptions, version.descriptions)
        self.assertEquals(self.concept1.retired, version.retired)
        self.assertEquals(self.concept1.public_access, version.public_access)
        self.assertEquals(self.concept1.external_id, version.external_id)
        self.assertFalse(version.released)
開發者ID:AnjaliWadhwa,項目名稱:oclapi,代碼行數:19,代碼來源:tests.py


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