本文整理汇总了Python中neo4django.tests.Person.name方法的典型用法代码示例。如果您正苦于以下问题:Python Person.name方法的具体用法?Python Person.name怎么用?Python Person.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neo4django.tests.Person
的用法示例。
在下文中一共展示了Person.name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_none_prop
# 需要导入模块: from neo4django.tests import Person [as 别名]
# 或者: from neo4django.tests.Person import name [as 别名]
def test_none_prop():
"""Confirm that `None` and null verification work properly."""
#first show that unsert properties are None
pete = Person()
pete.save()
assert pete.name is None
#then that `null=False` works properly
class NotNullPerson(models.NodeModel):
class Meta:
app_label = 'test'
name = models.StringProperty(null=False)
try:
andy = NotNullPerson(name = None)
andy.save()
except:
pass
else:
raise AssertionError('Non-nullable field accepted `None` as a value.')
#and finally, that setting a property to None deletes it in the db
pete.name = 'Pete'
pete.save()
pete.name = None
pete.save()
assert_gremlin('results=!g.v(node_id).any{it.hasProperty("name")}',
{'node_id':pete.id})
示例2: test_prop
# 需要导入模块: from neo4django.tests import Person [as 别名]
# 或者: from neo4django.tests.Person import name [as 别名]
def test_prop():
pete = Person(name='Pete')
assert pete.name == 'Pete'
pete.save()
assert pete.name == 'Pete'
pete.name = 'Peter'
assert pete.name == 'Peter'
pete.save()
assert pete.name == 'Peter'