def test_test_unicode_encoding(): unicode_whitelist = ['foo'] unicode_strict_whitelist = ['bar'] fname = 'abc' test_file = ['α'] raises( AssertionError, lambda: _test_this_file_encoding( fname, test_file, unicode_whitelist, unicode_strict_whitelist)) fname = 'abc' test_file = ['abc'] _test_this_file_encoding(fname, test_file, unicode_whitelist, unicode_strict_whitelist) fname = 'foo' test_file = ['abc'] raises( AssertionError, lambda: _test_this_file_encoding( fname, test_file, unicode_whitelist, unicode_strict_whitelist)) fname = 'bar' test_file = ['abc'] _test_this_file_encoding(fname, test_file, unicode_whitelist, unicode_strict_whitelist)
def test(fname): with open(fname, "rt", encoding="utf8") as test_file: test_this_file(fname, test_file) with open(fname, 'rt', encoding='utf8') as test_file: _test_this_file_encoding(fname, test_file)