Commit 205a4af1 by David Robinson

Mention increment method in README and added test case for ParseObject.delete().

parent 248b7569
...@@ -38,6 +38,12 @@ If we want to make an update, just call save() again after modifying an attribut ...@@ -38,6 +38,12 @@ If we want to make an update, just call save() again after modifying an attribut
>>> gameScore.save() >>> gameScore.save()
~~~~~ ~~~~~
You can also increment the score in a single API query:
~~~~~ {python}
>>> gameScore.increment("score")
~~~~~
Now that we've done all that work creating our first Parse object, let's delete it: Now that we've done all that work creating our first Parse object, let's delete it:
~~~~~ {python} ~~~~~ {python}
......
...@@ -128,6 +128,17 @@ class TestParseObjectAndQuery(unittest.TestCase): ...@@ -128,6 +128,17 @@ class TestParseObjectAndQuery(unittest.TestCase):
self.assertEqual(comment2.parent.objectId(), post_id) self.assertEqual(comment2.parent.objectId(), post_id)
self.assertEqual(comment2.parent.title, "I'm Hungry") self.assertEqual(comment2.parent.title, "I'm Hungry")
def test_delete(self):
"""Test deleting an object"""
o = test_obj(True)
obj_id = o.objectId()
self.check_test_obj(o)
o2 = ParsePy.ParseQuery("GameScore").get(obj_id)
self.check_test_obj(o2)
o2.delete()
self.assertRaises(urllib2.HTTPError,
ParsePy.ParseQuery("GameScore").get, obj_id)
if __name__ == "__main__": if __name__ == "__main__":
# command line # command line
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment