|
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 |
|
|---|
| 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 |
|
|---|
| 23 |
self.assertEqual(len(cache), 3) |
|---|
| 24 |
|
|---|
| 25 |
self.assertEqual(cache[key], key) |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
if __name__ == "__main__": |
|---|
| 30 |
unittest.main(__name__) |
|---|
| 31 |
|
|---|