py2.7c: test fxckers for basic py2.7 compatibility

master
Laura Liberda 2020-11-29 05:00:23 +01:00
parent 1f9cf6839f
commit c93f42fa9a
2 changed files with 22 additions and 0 deletions

View File

@ -1,3 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from ._map import fxckers_map
__all__ = ['fxckers_map']

19
tests/py2_compat.py Normal file
View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from os import listdir, path
import re
def test_fxcker_files_py2_compatibility():
dir = path.join('.', 'librefi', 'fxckers')
fxckers = listdir(dir)
for fxcker in fxckers:
if re.match(r'^\w+\.py$', fxcker):
with open(path.join(dir, fxcker), 'r') as file:
content = file.read()
if re.match(r'^(#!.+\r?\n)?\s*(# (-\*- )?coding: utf-8( -\*-)?\r?\n)?\s*(from __future__ import (\w+, )*unicode_literals)',
content) is None:
print(content)
print(fxcker)
raise AssertionError('fxcker %s not containing required compat imports' % (fxcker))