/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/tests/test_filters.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
import StringIO
18
 
from bzrlib import errors, filters
19
 
from bzrlib.filters import (
 
17
from .. import errors, filters
 
18
from ..filters import (
20
19
    ContentFilter,
21
20
    ContentFilterContext,
22
21
    filtered_input_file,
25
24
    _get_registered_names,
26
25
    internal_size_sha_file_byname,
27
26
    )
28
 
from bzrlib.osutils import sha_string
29
 
from bzrlib.tests import TestCase, TestCaseInTempDir
 
27
from ..osutils import sha_string
 
28
from ..sixish import (
 
29
    BytesIO,
 
30
    )
 
31
from . import TestCase, TestCaseInTempDir
30
32
 
31
33
 
32
34
# sample filter stacks
66
68
    def test_filtered_input_file(self):
67
69
        # test an empty stack returns the same result
68
70
        external = ''.join(_sample_external)
69
 
        f = StringIO.StringIO(external)
 
71
        f = BytesIO(external)
70
72
        self.assertEqual(external, filtered_input_file(f, None).read())
71
73
        # test a single item filter stack
72
 
        f = StringIO.StringIO(external)
 
74
        f = BytesIO(external)
73
75
        expected = ''.join(_internal_1)
74
76
        self.assertEqual(expected, filtered_input_file(f, _stack_1).read())
75
77
        # test a multi item filter stack
76
 
        f = StringIO.StringIO(external)
 
78
        f = BytesIO(external)
77
79
        expected = ''.join(_internal_2)
78
80
        self.assertEqual(expected, filtered_input_file(f, _stack_2).read())
79
81