/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 bzrlib/util/tests/test_bencode.py

  • Committer: Andrew Bennetts
  • Date: 2009-01-29 01:36:51 UTC
  • mto: This revision was merged to the branch mainline in revision 3971.
  • Revision ID: andrew.bennetts@canonical.com-20090129013651-qbt3lnl9i7jm89a3
Tweaks prompted by John's review.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
# Software.
24
24
 
25
25
 
26
 
from bzrlib.util.bencode import bencode, bdecode, bdecode_tuple, Bencached
 
26
from bzrlib.util.bencode import bencode, bdecode, bdecode_as_tuple, Bencached
27
27
from bzrlib.tests import TestCase
28
28
 
29
29
class TestBencode(TestCase):
189
189
        bdecode('d0:i3ee')
190
190
 
191
191
 
192
 
    def test_bdecode_tuple(self):
193
 
        assert bdecode_tuple('le') == ()
 
192
    def test_bdecode_as_tuple(self):
 
193
        assert bdecode_as_tuple('le') == ()
194
194
        try:
195
 
            bdecode_tuple('leanfdldjfh')
 
195
            bdecode_as_tuple('leanfdldjfh')
196
196
            assert 0
197
197
        except ValueError:
198
198
            pass
199
 
        assert bdecode_tuple('l0:0:0:e') == ('', '', '')
200
 
        assert bdecode_tuple('li1ei2ei3ee') == (1, 2, 3)
201
 
        assert bdecode_tuple('l3:asd2:xye') == ('asd', 'xy')
202
 
        assert bdecode_tuple('ll5:Alice3:Bobeli2ei3eee') == (('Alice', 'Bob'),
 
199
        assert bdecode_as_tuple('l0:0:0:e') == ('', '', '')
 
200
        assert bdecode_as_tuple('li1ei2ei3ee') == (1, 2, 3)
 
201
        assert bdecode_as_tuple('l3:asd2:xye') == ('asd', 'xy')
 
202
        assert bdecode_as_tuple('ll5:Alice3:Bobeli2ei3eee') == (('Alice', 'Bob'),
203
203
                (2, 3))
204
204
        try:
205
 
            bdecode_tuple('l-3:e')
 
205
            bdecode_as_tuple('l-3:e')
206
206
            assert 0
207
207
        except ValueError:
208
208
            pass