|
6 | 6 | from babel._compat import BytesIO |
7 | 7 |
|
8 | 8 | from django_babel.extract import extract_django |
| 9 | +from django.utils.encoding import force_bytes |
9 | 10 |
|
10 | 11 |
|
11 | 12 | default_keys = extract.DEFAULT_KEYWORDS.keys() |
@@ -45,12 +46,12 @@ def test_extract_with_interpolation(self): |
45 | 46 | self.assertEqual([(1, None, u'xxx%(anton)sxxx', [])], messages) |
46 | 47 |
|
47 | 48 | def test_extract_unicode(self): |
48 | | - buf = BytesIO(b'{% trans "@ſðæ314“ſſ¶ÐĐÞ→SÆ^ĸŁ" %}') |
| 49 | + buf = BytesIO(force_bytes('{% trans "@ſðæ314“ſſ¶ÐĐÞ→SÆ^ĸŁ" %}')) |
49 | 50 | messages = list(extract_django(buf, default_keys, [], {})) |
50 | 51 | self.assertEqual([(1, None, u'@ſðæ314“ſſ¶ÐĐÞ→SÆ^ĸŁ', [])], messages) |
51 | 52 |
|
52 | 53 | def test_extract_unicode_blocktrans(self): |
53 | | - buf = BytesIO(b'{% blocktrans %}@ſðæ314“ſſ¶ÐĐÞ→SÆ^ĸŁ{% endblocktrans %}') |
| 54 | + buf = BytesIO(force_bytes('{% blocktrans %}@ſðæ314“ſſ¶ÐĐÞ→SÆ^ĸŁ{% endblocktrans %}')) |
54 | 55 | messages = list(extract_django(buf, default_keys, [], {})) |
55 | 56 | self.assertEqual([(1, None, u'@ſðæ314“ſſ¶ÐĐÞ→SÆ^ĸŁ', [])], messages) |
56 | 57 |
|
@@ -78,7 +79,7 @@ def test_extract_singular_form(self): |
78 | 79 | def test_trans_blocks_must_not_include_other_block_tags(self): |
79 | 80 | buf = BytesIO(b'{% blocktrans %}{% other_tag %}{% endblocktrans %}') |
80 | 81 | gen = extract_django(buf, default_keys, [], {}) |
81 | | - pytest.raises(SyntaxError, gen.next) |
| 82 | + pytest.raises(SyntaxError, next, gen) |
82 | 83 |
|
83 | 84 | def test_extract_var(self): |
84 | 85 | buf = BytesIO(b'{{ book }}') |
|
0 commit comments