/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__rio.py

  • Committer: Jelmer Vernooij
  • Date: 2020-07-05 12:50:01 UTC
  • mfrom: (7490.40.46 work)
  • mto: (7490.40.48 work)
  • mto: This revision was merged to the branch mainline in revision 7519.
  • Revision ID: jelmer@jelmer.uk-20200705125001-7s3vo0p55szbbws7
Merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for _rio_*."""
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
from .. import (
20
22
    rio,
21
23
    tests,
22
24
    )
 
25
from ..sixish import (
 
26
    text_type,
 
27
    )
23
28
 
24
29
 
25
30
def load_tests(loader, standard_tests, pattern):
51
56
        self.assertFalse(self.module._valid_tag(""))
52
57
 
53
58
    def test_unicode(self):
54
 
        # When str is a unicode type, it is valid for a tag
55
 
        self.assertTrue(self.module._valid_tag(u"foo"))
 
59
        if text_type is str:
 
60
            # When str is a unicode type, it is valid for a tag
 
61
            self.assertTrue(self.module._valid_tag(u"foo"))
 
62
        else:
 
63
            self.assertRaises(TypeError, self.module._valid_tag, u"foo")
56
64
 
57
65
    def test_non_ascii_char(self):
58
66
        self.assertFalse(self.module._valid_tag("\xb5"))
68
76
        if s is not None:
69
77
            for tag, value in s.iter_pairs():
70
78
                self.assertIsInstance(tag, str)
71
 
                self.assertIsInstance(value, str)
 
79
                self.assertIsInstance(value, text_type)
72
80
 
73
81
    def assertReadStanzaRaises(self, exception, line_iter):
74
82
        self.assertRaises(exception, self.module._read_stanza_utf8, line_iter)
124
132
        if s is not None:
125
133
            for tag, value in s.iter_pairs():
126
134
                self.assertIsInstance(tag, str)
127
 
                self.assertIsInstance(value, str)
 
135
                self.assertIsInstance(value, text_type)
128
136
 
129
137
    def assertReadStanzaRaises(self, exception, line_iter):
130
138
        self.assertRaises(exception, self.module._read_stanza_unicode,