@@ -58,35 +58,22 @@ def test_encode_within_a_dict(self):
58
58
def test_encode_within_a_list (self ):
59
59
output = force_default_fs_coding_rec (['foo' , 'bar' , 'baz' ])
60
60
61
- truth = [force_default_str_coding ('foo' ),
62
- force_default_str_coding ('bar' ),
63
- force_default_str_coding ('baz' )]
61
+ self .assertEqual (output , [b'foo' , b'bar' , b'baz' ])
64
62
65
- self .assertEqual (output , truth )
66
-
67
- def test_encode_within_a_tuple (self ):
63
+ def test_encode_within_a_tuple_string (self ):
68
64
output = force_default_fs_coding_rec (('foo' , 'bar' , 'baz' ))
69
- truth = (force_default_str_coding ('foo' ),
70
- force_default_str_coding ('bar' ),
71
- force_default_str_coding ('baz' ))
72
65
73
- self .assertEqual (output , truth )
66
+ self .assertEqual (output , ( b'foo' , b'bar' , b'baz' ) )
74
67
75
68
def test_encode_within_a_tuple_bytes (self ):
76
- output = force_default_fs_coding_rec (('foo' , 'bar' , 'baz' ))
77
- truth = (force_default_str_coding ('foo' ),
78
- force_default_str_coding ('bar' ),
79
- force_default_str_coding ('baz' ))
69
+ output = force_default_fs_coding_rec ((b'foo' , b'bar' , b'baz' ))
80
70
81
- self .assertEqual (output , truth )
71
+ self .assertEqual (output , ( b'foo' , b'bar' , b'baz' ) )
82
72
83
73
def test_encode_within_a_tuple_unicode (self ):
84
- output = force_default_fs_coding_rec (('foo' , 'bar' , 'baz' ))
85
- truth = (force_default_str_coding ('foo' ),
86
- force_default_str_coding ('bar' ),
87
- force_default_str_coding ('baz' ))
74
+ output = force_default_fs_coding_rec ((u'foo' , u'bar' , u'baz' ))
88
75
89
- self .assertEqual (output , truth )
76
+ self .assertEqual (output , ( b'foo' , b'bar' , b'baz' ) )
90
77
91
78
92
79
class MigSharedBase__force_utf8 (MigTestCase ):
@@ -95,29 +82,36 @@ class MigSharedBase__force_utf8(MigTestCase):
95
82
def test_encode_string (self ):
96
83
output = force_utf8 ('foobar' )
97
84
98
- self .assertEqual (output , truth )
85
+ self .assertEqual (output , b'foobar' )
99
86
100
87
def test_encode_bytes (self ):
101
88
output = force_utf8 (b'foobar' )
102
89
103
- self .assertEqual (output , truth )
90
+ self .assertEqual (output , b'foobar' )
104
91
105
92
def test_encode_unicode (self ):
106
93
output = force_utf8 (u'foobar' )
107
94
108
- self .assertEqual (output , truth )
95
+ self .assertEqual (output , b'foobar' )
109
96
110
97
111
98
class MigSharedBase__force_unicode (MigTestCase ):
112
99
"""Unit tests of mig.shared.base force_unicode()"""
113
100
114
- def test_encode_a_string (self ):
115
- # input_vals = (b'foobar', u'foobar')
116
- # truth = u'foobar'
117
- # for val in input_vals:
118
- # output = force_unicode(val)
119
- # self.assertEqual(output, truth)
120
- pass
101
+ def test_encode_string (self ):
102
+ output = force_unicode ('foobar' )
103
+
104
+ self .assertEqual (output , u'foobar' )
105
+
106
+ def test_encode_bytes (self ):
107
+ output = force_unicode (b'foobar' )
108
+
109
+ self .assertEqual (output , u'foobar' )
110
+
111
+ def test_encode_unicode (self ):
112
+ output = force_unicode (u'foobar' )
113
+
114
+ self .assertEqual (output , u'foobar' )
121
115
122
116
if __name__ == '__main__' :
123
117
testmain (failfast = True )
0 commit comments