Exemplo n.º 1
0
 def test_with_invalid_encoding(self):
   file1 = os.path.join(self.test_tmpdir, 'testfile1')
   with open(file1, 'w') as f:
     f.write(u'#! /bin/python2\n')
     f.write(u'# -*- coding: iso-3-14159 -*-\n')
   self.assertFalse(file_resources.IsPythonFile(file1))
Exemplo n.º 2
0
 def test_empty_without_py_extension(self):
   file1 = os.path.join(self.test_tmpdir, 'testfile1')
   self.assertFalse(file_resources.IsPythonFile(file1))
   file2 = os.path.join(self.test_tmpdir, 'testfile1.rb')
   self.assertFalse(file_resources.IsPythonFile(file2))
Exemplo n.º 3
0
 def test_with_latin_encoding(self):
   file1 = os.path.join(self.test_tmpdir, 'testfile1')
   with py3compat.open_with_encoding(file1, mode='w', encoding='latin-1') as f:
     f.write(u'#! /bin/python2\n')
   self.assertTrue(file_resources.IsPythonFile(file1))
Exemplo n.º 4
0
 def test_with_py_extension(self):
   file1 = os.path.join(self.test_tmpdir, 'testfile1.py')
   self.assertTrue(file_resources.IsPythonFile(file1))