Back to index

python3.2  3.2.2
Public Member Functions | Private Member Functions
test.test_tokenize.TestTokenizerAdheresToPep0263 Class Reference
Inheritance diagram for test.test_tokenize.TestTokenizerAdheresToPep0263:
Inheritance graph
[legend]
Collaboration diagram for test.test_tokenize.TestTokenizerAdheresToPep0263:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_utf8_coding_cookie_and_no_utf8_bom
def test_latin1_coding_cookie_and_utf8_bom
def test_no_coding_cookie_and_utf8_bom
def test_utf8_coding_cookie_and_utf8_bom

Private Member Functions

def _testFile

Detailed Description

Test that tokenizer adheres to the coding behaviour stipulated in PEP 0263.

Definition at line 645 of file test_tokenize.py.


Member Function Documentation

def test.test_tokenize.TestTokenizerAdheresToPep0263._testFile (   self,
  filename 
) [private]

Definition at line 650 of file test_tokenize.py.

00650 
00651     def _testFile(self, filename):
00652         path = os.path.join(os.path.dirname(__file__), filename)
00653         return roundtrip(open(path, 'rb'))

Here is the call graph for this function:

As per PEP 0263, if a file starts with a utf-8 BOM signature, the only
allowed encoding for the comment is 'utf-8'.  The text file used in
this test starts with a BOM signature, but specifies latin1 as the
coding, so verify that a SyntaxError is raised, which matches the
behaviour of the interpreter when it encounters a similar condition.

Definition at line 658 of file test_tokenize.py.

00658 
00659     def test_latin1_coding_cookie_and_utf8_bom(self):
00660         """
00661         As per PEP 0263, if a file starts with a utf-8 BOM signature, the only
00662         allowed encoding for the comment is 'utf-8'.  The text file used in
00663         this test starts with a BOM signature, but specifies latin1 as the
00664         coding, so verify that a SyntaxError is raised, which matches the
00665         behaviour of the interpreter when it encounters a similar condition.
00666         """
00667         f = 'tokenize_tests-latin1-coding-cookie-and-utf8-bom-sig.txt'
00668         self.assertRaises(SyntaxError, self._testFile, f)

Here is the call graph for this function:

Definition at line 669 of file test_tokenize.py.

00669 
00670     def test_no_coding_cookie_and_utf8_bom(self):
00671         f = 'tokenize_tests-no-coding-cookie-and-utf8-bom-sig-only.txt'
00672         self.assertTrue(self._testFile(f))

Here is the call graph for this function:

Definition at line 654 of file test_tokenize.py.

00654 
00655     def test_utf8_coding_cookie_and_no_utf8_bom(self):
00656         f = 'tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt'
00657         self.assertTrue(self._testFile(f))

Here is the call graph for this function:

Definition at line 673 of file test_tokenize.py.

00673 
00674     def test_utf8_coding_cookie_and_utf8_bom(self):
00675         f = 'tokenize_tests-utf8-coding-cookie-and-utf8-bom-sig.txt'
00676         self.assertTrue(self._testFile(f))
00677 

Here is the call graph for this function:


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