File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
22
3+ import os
4+
35try :
46 import unittest2 as unittest
57except ImportError :
@@ -102,5 +104,20 @@ def test_get_source_latin1(self):
102104 self .assertEqual (inspection .get_source_unicode (encoding_latin1 .foo ),
103105 foo_non_ascii )
104106
107+ def test_get_source_file (self ):
108+ path = os .path .join (os .path .dirname (os .path .abspath (__file__ )),
109+ 'fodder' )
110+
111+ encoding = inspection .get_encoding_file (
112+ os .path .join (path , 'encoding_ascii.py' ))
113+ self .assertEqual (encoding , 'ascii' )
114+ encoding = inspection .get_encoding_file (
115+ os .path .join (path , 'encoding_latin1.py' ))
116+ self .assertEqual (encoding , 'latin1' )
117+ encoding = inspection .get_encoding_file (
118+ os .path .join (path , 'encoding_utf8.py' ))
119+ self .assertEqual (encoding , 'utf-8' )
120+
121+
105122if __name__ == '__main__' :
106123 unittest .main ()
You can’t perform that action at this time.
0 commit comments