~ubuntu-branches/ubuntu/precise/python3.2/precise-proposed

« back to all changes in this revision

Viewing changes to Lib/test/test_functools.py

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-03-09 18:40:39 UTC
  • mfrom: (30.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20120309184039-j3yk2emxr1plyo21
Tags: 3.2.3~rc1-1
* Python 3.2.3 release candidate 1.
* Update to 20120309 from the 3.2 branch.
* Fix libpython.a symlink. Closes: #660146.
* Build-depend on xauth.
* Run the gdb tests for the debug build only.

Show diffs side-by-side

added added

removed removed

Lines of Context:
655
655
        self.assertEqual(fib.cache_info(),
656
656
            functools._CacheInfo(hits=0, misses=0, maxsize=None, currsize=0))
657
657
 
 
658
    def test_lru_with_exceptions(self):
 
659
        # Verify that user_function exceptions get passed through without
 
660
        # creating a hard-to-read chained exception.
 
661
        # http://bugs.python.org/issue13177
 
662
        for maxsize in (None, 100):
 
663
            @functools.lru_cache(maxsize)
 
664
            def func(i):
 
665
                return 'abc'[i]
 
666
            self.assertEqual(func(0), 'a')
 
667
            with self.assertRaises(IndexError) as cm:
 
668
                func(15)
 
669
            self.assertIsNone(cm.exception.__context__)
 
670
            # Verify that the previous exception did not result in a cached entry
 
671
            with self.assertRaises(IndexError):
 
672
                func(15)
 
673
 
658
674
def test_main(verbose=None):
659
675
    test_classes = (
660
676
        TestPartial,