Show More
@@ -65,6 +65,13 syntax = \ | |||
|
65 | 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 | 75 | # Tests for the escape transformer to leave normal code alone |
|
69 | 76 | escaped_noesc = |
|
70 | 77 | [ (' ', ' '), |
@@ -203,6 +210,20 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 | 227 | multiline_datastructure_prompt = |
|
207 | 228 | [ [('>>> a = [1,','a = [1,'), |
|
208 | 229 | ('... 2]','2]'), |
@@ -291,6 +312,11 def test_ipy_prompt(): | |||
|
291 | 312 | for example in syntax_ml['ipy_prompt']: |
|
292 | 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 | 320 | def test_assemble_logical_lines(): |
|
295 | 321 | tests = \ |
|
296 | 322 | [ [(u"a = \\", None), |
General Comments 0
You need to be logged in to leave comments.
Login now