Contact: fumanchu@aminus.org

Log in as guest/geniusql to create tickets

root/trunk/geniusql/test/test_deparser.py

Revision 311 (checked in by lakin, 7 months ago)

further fixes to the whitespace.

Line 
1 import unittest
2
3 from geniusql import deparse
4
5
6
7 class DeparserTests(unittest.TestCase):
8
9     def test_deparser_sqlcache_limit(self):
10         # asserts that the SqlCache class is actually length limited
11
12         cache = deparse.SqlCache(max=3)
13
14         self.assertEqual(len(cache), 0)
15
16         for num in [1, 2, 3]:
17             cache[num] = 'meh'
18             self.assertEqual(len(cache), num)
19
20         for key in ['O1', 'O2', 'O3', 'O4']:
21             cache[key] = key
22             # the number of entries in the cache should never be > 3 (the max)
23             self.assertEqual(len(cache), 3)
24             # and the entry we just cached must be there
25             self.assertEqual(cache[key], key)
26
27
28
29 if __name__ == "__main__":
30     unittest.main(__name__)
31
Note: See TracBrowser for help on using the browser.