Show More
@@ -65,6 +65,13 b' syntax = \\' | |||||
65 | (' ',' '), # blank lines are kept intact |
|
65 | (' ',' '), # blank lines are kept intact | |
66 | ], |
|
66 | ], | |
67 |
|
67 | |||
|
68 | strip_encoding_cookie = | |||
|
69 | [ | |||
|
70 | ('# -*- encoding: utf-8 -*-', ''), | |||
|
71 | ('# coding: latin-1', ''), | |||
|
72 | ], | |||
|
73 | ||||
|
74 | ||||
68 | # Tests for the escape transformer to leave normal code alone |
|
75 | # Tests for the escape transformer to leave normal code alone | |
69 | escaped_noesc = |
|
76 | escaped_noesc = | |
70 | [ (' ', ' '), |
|
77 | [ (' ', ' '), | |
@@ -203,6 +210,20 b' syntax_ml = \\' | |||||
203 | ], |
|
210 | ], | |
204 | ], |
|
211 | ], | |
205 |
|
212 | |||
|
213 | strip_encoding_cookie = | |||
|
214 | [ | |||
|
215 | [ | |||
|
216 | ('# -*- coding: utf-8 -*-', ''), | |||
|
217 | ('foo', 'foo'), | |||
|
218 | ], | |||
|
219 | [ | |||
|
220 | ('#!/usr/bin/env python', '#!/usr/bin/env python'), | |||
|
221 | ('# -*- coding: latin-1 -*-', ''), | |||
|
222 | # only the first-two lines | |||
|
223 | ('# -*- coding: latin-1 -*-', '# -*- coding: latin-1 -*-'), | |||
|
224 | ], | |||
|
225 | ], | |||
|
226 | ||||
206 | multiline_datastructure_prompt = |
|
227 | multiline_datastructure_prompt = | |
207 | [ [('>>> a = [1,','a = [1,'), |
|
228 | [ [('>>> a = [1,','a = [1,'), | |
208 | ('... 2]','2]'), |
|
229 | ('... 2]','2]'), | |
@@ -291,6 +312,11 b' def test_ipy_prompt():' | |||||
291 | for example in syntax_ml['ipy_prompt']: |
|
312 | for example in syntax_ml['ipy_prompt']: | |
292 | transform_checker(example, ipt.ipy_prompt) |
|
313 | transform_checker(example, ipt.ipy_prompt) | |
293 |
|
314 | |||
|
315 | def test_coding_cookie(): | |||
|
316 | tt.check_pairs(transform_and_reset(ipt.strip_encoding_cookie), syntax['strip_encoding_cookie']) | |||
|
317 | for example in syntax_ml['strip_encoding_cookie']: | |||
|
318 | transform_checker(example, ipt.strip_encoding_cookie) | |||
|
319 | ||||
294 | def test_assemble_logical_lines(): |
|
320 | def test_assemble_logical_lines(): | |
295 | tests = \ |
|
321 | tests = \ | |
296 | [ [(u"a = \\", None), |
|
322 | [ [(u"a = \\", None), |
General Comments 0
You need to be logged in to leave comments.
Login now