Skip to content
This repository
Browse code

testing fk caching and noting todos

  • Loading branch information...
commit 73c4fbc8902913c0180b4ca9254b5d2d42a0d769 1 parent 22a6158
Charles Leifer authored October 02, 2012

Showing 2 changed files with 16 additions and 1 deletion. Show diff stats Hide diff stats

  1. 5  TODO.rst
  2. 12  tests.py
5  TODO.rst
Source Rendered
... ...
@@ -1,5 +1,8 @@
1 1
 todo
2 2
 ====
3 3
 
4  
-* tests
  4
+* inheritance test
  5
+* model options test
  6
+* Q() with django syntax
  7
+* backwards compat, esp places where existing api allows strings
5 8
 * docs
12  tests.py
@@ -767,6 +767,18 @@ def test_fk_ints(self):
767 767
         c2_db = Category.get(Category.id == c2.id)
768 768
         self.assertEqual(c2_db.parent, c1)
769 769
 
  770
+    def test_fk_caching(self):
  771
+        c1 = Category.create(name='c1')
  772
+        c2 = Category.create(name='c2', parent=c1)
  773
+        c2_db = Category.get(Category.id == c2.id)
  774
+        qc = len(self.queries())
  775
+
  776
+        parent = c2_db.parent
  777
+        self.assertEqual(parent, c1)
  778
+
  779
+        parent = c2_db.parent
  780
+        self.assertEqual(len(self.queries()) - qc, 1)
  781
+
770 782
     def test_creation(self):
771 783
         self.create_users(10)
772 784
         self.assertEqual(User.select().count(), 10)

0 notes on commit 73c4fbc

Please sign in to comment.
Something went wrong with that request. Please try again.