本文整理汇总了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()
示例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)