Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

testing fk caching and noting todos

  • Loading branch information...
commit 73c4fbc8902913c0180b4ca9254b5d2d42a0d769 1 parent 22a6158
Charles Leifer authored
Showing with 16 additions and 1 deletion.
  1. +4 −1 TODO.rst
  2. +12 −0 tests.py
5 TODO.rst
View
@@ -1,5 +1,8 @@
todo
====
-* tests
+* inheritance test
+* model options test
+* Q() with django syntax
+* backwards compat, esp places where existing api allows strings
* docs
12 tests.py
View
@@ -767,6 +767,18 @@ def test_fk_ints(self):
c2_db = Category.get(Category.id == c2.id)
self.assertEqual(c2_db.parent, c1)
+ def test_fk_caching(self):
+ c1 = Category.create(name='c1')
+ c2 = Category.create(name='c2', parent=c1)
+ c2_db = Category.get(Category.id == c2.id)
+ qc = len(self.queries())
+
+ parent = c2_db.parent
+ self.assertEqual(parent, c1)
+
+ parent = c2_db.parent
+ self.assertEqual(len(self.queries()) - qc, 1)
+
def test_creation(self):
self.create_users(10)
self.assertEqual(User.select().count(), 10)
Please sign in to comment.
Something went wrong with that request. Please try again.