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})
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})
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'
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'
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"