Back to index

python3.2  3.2.2
Public Member Functions
test.test_pep263.PEP263Test Class Reference

List of all members.

Public Member Functions

def test_pep263
def test_compilestring
def test_issue2301
def test_issue4626
def test_issue3297
def test_issue7820

Detailed Description

Definition at line 6 of file test_pep263.py.


Member Function Documentation

Definition at line 18 of file test_pep263.py.

00018 
00019     def test_compilestring(self):
00020         # see #1882
00021         c = compile(b"\n# coding: utf-8\nu = '\xc3\xb3'\n", "dummy", "exec")
00022         d = {}
00023         exec(c, d)
00024         self.assertEqual(d['u'], '\xf3')

Here is the call graph for this function:

Definition at line 25 of file test_pep263.py.

00025 
00026     def test_issue2301(self):
00027         try:
00028             compile(b"# coding: cp932\nprint '\x94\x4e'", "dummy", "exec")
00029         except SyntaxError as v:
00030             self.assertEqual(v.text, "print '\u5e74'\n")
00031         else:
00032             self.fail()

Here is the call graph for this function:

Definition at line 39 of file test_pep263.py.

00039 
00040     def test_issue3297(self):
00041         c = compile("a, b = '\U0001010F', '\\U0001010F'", "dummy", "exec")
00042         d = {}
00043         exec(c, d)
00044         self.assertEqual(d['a'], d['b'])
00045         self.assertEqual(len(d['a']), len(d['b']))
00046         self.assertEqual(ascii(d['a']), ascii(d['b']))

Here is the call graph for this function:

Definition at line 33 of file test_pep263.py.

00033 
00034     def test_issue4626(self):
00035         c = compile("# coding=latin-1\n\u00c6 = '\u00c6'", "dummy", "exec")
00036         d = {}
00037         exec(c, d)
00038         self.assertEqual(d['\xc6'], '\xc6')

Here is the call graph for this function:

Definition at line 47 of file test_pep263.py.

00047 
00048     def test_issue7820(self):
00049         # Ensure that check_bom() restores all bytes in the right order if
00050         # check_bom() fails in pydebug mode: a buffer starts with the first
00051         # byte of a valid BOM, but next bytes are different
00052 
00053         # one byte in common with the UTF-16-LE BOM
00054         self.assertRaises(SyntaxError, eval, b'\xff\x20')
00055 
00056         # two bytes in common with the UTF-8 BOM
00057         self.assertRaises(SyntaxError, eval, b'\xef\xbb\x20')

Here is the call graph for this function:

Definition at line 8 of file test_pep263.py.

00008 
00009     def test_pep263(self):
00010         self.assertEqual(
00011             "".encode("utf-8"),
00012             b'\xd0\x9f\xd0\xb8\xd1\x82\xd0\xbe\xd0\xbd'
00013         )
00014         self.assertEqual(
00015             "\".encode("utf-8"),
00016             b'\\\xd0\x9f'
00017         )

Here is the call graph for this function:


The documentation for this class was generated from the following file: