]>
Raphaƫl G. Git Repositories - youtubedl/blob - test/test_unicode_literals.py
1 from __future__
import unicode_literals
8 rootDir
= os
.path
.dirname(os
.path
.dirname(os
.path
.abspath(__file__
)))
11 'setup.py', # http://bugs.python.org/issue13943
15 class TestUnicodeLiterals(unittest
.TestCase
):
16 def test_all_files(self
):
17 print('Skipping this test (not yet fully implemented)')
20 for dirpath
, _
, filenames
in os
.walk(rootDir
):
21 for basename
in filenames
:
22 if not basename
.endswith('.py'):
24 if basename
in IGNORED_FILES
:
27 fn
= os
.path
.join(dirpath
, basename
)
28 with io
.open(fn
, encoding
='utf-8') as inf
:
31 if "'" not in code
and '"' not in code
:
33 imps
= 'from __future__ import unicode_literals'
36 ' %s missing in %s' % (imps
, fn
))
38 m
= re
.search(r
'(?<=\s)u[\'"](?!\)|,|$)', code)
42 'u present in %s, around %s' % (
43 fn, code[m.start() - 10:m.end() + 10]))
46 if __name__ == '__main__':