Browse Source

Test that argspecs are maintained in lrucache

tags/nilmdb-0.1
Jim Paris 8 years ago
parent
commit
40cf4941f0
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      tests/test_lrucache.py

+ 10
- 0
tests/test_lrucache.py View File

@@ -6,6 +6,7 @@ from nose.tools import *
from nose.tools import assert_raises
import threading
import time
import inspect

from testutil.helpers import *

@@ -33,6 +34,7 @@ class Foo:

class TestLRUCache(object):
def test(self):

[ foo1(n) for n in [ 1, 2, 3, 1, 2, 3, 1, 2, 3 ] ]
eq_((foo1.cache_hits, foo1.cache_misses), (6, 3))
[ foo1(n) for n in [ 1, 2, 3, 1, 2, 3, 1, 2, 3 ] ]
@@ -67,3 +69,11 @@ class TestLRUCache(object):
foo.foo(7)
foo.foo(5)
eq_(foo.calls, 3)

# Verify that argspecs were maintained
eq_(inspect.getargspec(foo1),
inspect.ArgSpec(args=['n'],
varargs=None, keywords=None, defaults=None))
eq_(inspect.getargspec(foo.foo),
inspect.ArgSpec(args=['self', 'n'],
varargs=None, keywords=None, defaults=None))

Loading…
Cancel
Save