/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test__bencode.py

  • Committer: Jelmer Vernooij
  • Date: 2019-05-29 03:22:34 UTC
  • mfrom: (7303 work)
  • mto: This revision was merged to the branch mainline in revision 7306.
  • Revision ID: jelmer@jelmer.uk-20190529032234-mt3fuws8gq03tapi
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
def load_tests(loader, standard_tests, pattern):
25
25
    suite, _ = tests.permute_tests_for_extension(standard_tests, loader,
26
 
        'breezy.util._bencode_py', 'breezy._bencode_pyx')
 
26
                                                 'breezy.util._bencode_py', 'breezy._bencode_pyx')
27
27
    return suite
28
28
 
29
29
 
92
92
        self._run_check_error(ValueError, b'00:')
93
93
        self._run_check_error(ValueError, b'35208734823ljdahflajhdf')
94
94
        self._run_check_error(ValueError, b'432432432432432:foo')
95
 
        self._run_check_error(ValueError, b' 1:x') # leading whitespace
96
 
        self._run_check_error(ValueError, b'-1:x') # negative
97
 
        self._run_check_error(ValueError, b'1 x') # space vs colon
98
 
        self._run_check_error(ValueError, b'1x') # missing colon
 
95
        self._run_check_error(ValueError, b' 1:x')  # leading whitespace
 
96
        self._run_check_error(ValueError, b'-1:x')  # negative
 
97
        self._run_check_error(ValueError, b'1 x')  # space vs colon
 
98
        self._run_check_error(ValueError, b'1x')  # missing colon
99
99
        self._run_check_error(ValueError, (b'1' * 1000) + b':')
100
100
 
101
101
    def test_list(self):
118
118
 
119
119
    def test_dict(self):
120
120
        self._check({}, b'de')
121
 
        self._check({b'':3}, b'd0:i3ee')
 
121
        self._check({b'': 3}, b'd0:i3ee')
122
122
        self._check({b'age': 25, b'eyes': b'blue'}, b'd3:agei25e4:eyes4:bluee')
123
123
        self._check({b'spam.mp3': {b'author': b'Alice', b'length': 100000}},
124
 
            b'd8:spam.mp3d6:author5:Alice6:lengthi100000eee')
 
124
                    b'd8:spam.mp3d6:author5:Alice6:lengthi100000eee')
125
125
 
126
126
    def test_dict_deepnested(self):
127
127
        with RecursionLimit():
206
206
        self._check(b'de', {})
207
207
        self._check(b'd3:agei25e4:eyes4:bluee', {b'age': 25, b'eyes': b'blue'})
208
208
        self._check(b'd8:spam.mp3d6:author5:Alice6:lengthi100000eee',
209
 
            {b'spam.mp3': {b'author': b'Alice', b'length': 100000}})
 
209
                    {b'spam.mp3': {b'author': b'Alice', b'length': 100000}})
210
210
 
211
211
    def test_dict_deep_nested(self):
212
212
        d = top = {}
225
225
    def test_bool(self):
226
226
        self._check(b'i1e', True)
227
227
        self._check(b'i0e', False)
228