Skip to content

Commit

Permalink
Fixup from last commit for compatibility with Python < 3.10.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjordan committed Sep 14, 2024
1 parent cdf2670 commit 492a6e3
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions tests/unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1615,22 +1615,24 @@ class TestFileIsUtf8(unittest.TestCase):
def test_file_is_utf8(self):
current_dir = os.path.dirname(os.path.abspath(__file__))
input_files_dir = os.path.join(current_dir, "assets", "file_is_utf8_test")
for file_to_test in os.listdir(input_files_dir):
if file_to_test.startswith("true_"):
is_utf8 = workbench_utils.file_is_utf8(
os.path.join(input_files_dir, file_to_test)
)
self.assertEqual(is_utf8, True)
with os.scandir(input_files_dir) as files_to_test:
for file_to_test in files_to_test:
if file_to_test.name.startswith("true_"):
is_utf8 = workbench_utils.file_is_utf8(
os.path.join(input_files_dir, file_to_test)
)
self.assertEqual(is_utf8, True)

def test_file_is_not_utf8(self):
current_dir = os.path.dirname(os.path.abspath(__file__))
input_files_dir = os.path.join(current_dir, "assets", "file_is_utf8_test")
for file_to_test in os.listdir(input_files_dir):
if file_to_test.startswith("false_"):
is_utf8 = workbench_utils.file_is_utf8(
os.path.join(input_files_dir, file_to_test)
)
self.assertEqual(is_utf8, False)
with os.scandir(input_files_dir) as files_to_test:
for file_to_test in files_to_test:
if file_to_test.name.startswith("false_"):
is_utf8 = workbench_utils.file_is_utf8(
os.path.join(input_files_dir, file_to_test)
)
self.assertEqual(is_utf8, False)


if __name__ == "__main__":
Expand Down

0 comments on commit 492a6e3

Please sign in to comment.