/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
0.358.2 by Jelmer Vernooij
Refresh copyright headers, add my email.
1
# Copyright (C) 2011-2018 Jelmer Vernooij <jelmer@jelmer.uk>
0.200.1292 by Jelmer Vernooij
Fix repeeling objects when determining what to send.
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
0.358.1 by Jelmer Vernooij
Fix FSF address.
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
0.200.1292 by Jelmer Vernooij
Fix repeeling objects when determining what to send.
16
17
"""Tests for the unpeel map."""
18
0.358.3 by Jelmer Vernooij
Enable absolute import.
19
from __future__ import absolute_import
20
6964.2.1 by Jelmer Vernooij
Initial work to support brz-git on python3.
21
from io import BytesIO
0.200.1292 by Jelmer Vernooij
Fix repeeling objects when determining what to send.
22
6986.2.1 by Jelmer Vernooij
Move breezy.plugins.git to breezy.git.
23
from ...tests import (
0.200.1292 by Jelmer Vernooij
Fix repeeling objects when determining what to send.
24
    TestCaseWithTransport,
25
    )
26
0.200.1642 by Jelmer Vernooij
Use relative imports in tests.
27
from ..unpeel_map import (
0.200.1292 by Jelmer Vernooij
Fix repeeling objects when determining what to send.
28
    UnpeelMap,
29
    )
30
31
32
class TestUnpeelMap(TestCaseWithTransport):
33
34
    def test_new(self):
35
        m = UnpeelMap()
7143.15.2 by Jelmer Vernooij
Run autopep8.
36
        self.assertIs(None, m.peel_tag("ab" * 20))
0.200.1292 by Jelmer Vernooij
Fix repeeling objects when determining what to send.
37
38
    def test_load(self):
6964.2.1 by Jelmer Vernooij
Initial work to support brz-git on python3.
39
        f = BytesIO(
40
            b"unpeel map version 1\n"
41
            b"0123456789012345678901234567890123456789: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n")
0.200.1292 by Jelmer Vernooij
Fix repeeling objects when determining what to send.
42
        m = UnpeelMap()
43
        m.load(f)
6964.2.3 by Jelmer Vernooij
Review comments.
44
        self.assertEqual(b"0123456789012345678901234567890123456789",
7143.15.2 by Jelmer Vernooij
Run autopep8.
45
                         m.peel_tag(b"aa" * 20))
0.200.1292 by Jelmer Vernooij
Fix repeeling objects when determining what to send.
46
47
    def test_update(self):
48
        m = UnpeelMap()
49
        m.update({
7143.15.2 by Jelmer Vernooij
Run autopep8.
50
            b"0123456789012345678901234567890123456789": set([b"aa" * 20]),
51
            })
6964.2.3 by Jelmer Vernooij
Review comments.
52
        self.assertEqual(b"0123456789012345678901234567890123456789",
7143.15.2 by Jelmer Vernooij
Run autopep8.
53
                         m.peel_tag(b"aa" * 20))