~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__bencode.py

  • Committer: Andrew Bennetts
  • Date: 2010-07-29 11:17:57 UTC
  • mfrom: (5050.3.17 2.2)
  • mto: This revision was merged to the branch mainline in revision 5365.
  • Revision ID: andrew.bennetts@canonical.com-20100729111757-018h3pcefo7z0dnq
Merge lp:bzr/2.2 into lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for bencode structured encoding"""
18
18
 
19
 
import sys
20
 
 
21
19
from bzrlib import tests
22
20
 
23
21
def load_tests(standard_tests, module, loader):
107
105
                            'd8:spam.mp3d6:author5:Alice6:lengthi100000eee')
108
106
 
109
107
    def test_dict_deepnested(self):
110
 
        # The recursion here provokes CPython into emitting a warning on
111
 
        # stderr, "maximum recursion depth exceeded in __subclasscheck__", due
112
 
        # to running out of stack space while evaluating "except (...):" in
113
 
        # _bencode_py.  This is harmless, so we temporarily override stderr to
114
 
        # avoid distracting noise in the test output.
115
 
        self.overrideAttr(sys, 'stderr', self._log_file)
116
 
        self._run_check_error(
117
 
            RuntimeError, ("d0:" * 10000) + 'i1e' + ("e" * 10000))
 
108
        self._run_check_error(RuntimeError, ("d0:" * 10000) + 'i1e' + ("e" * 10000))
118
109
 
119
110
    def test_malformed_dict(self):
120
111
        self._run_check_error(ValueError, 'd')