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 ca745ac commit 382fed7
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions tests/unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import os
from ruamel.yaml import YAML
import collections
import glob
import tempfile
import unittest

Expand Down Expand Up @@ -1616,24 +1615,26 @@ 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")
files_to_test = glob.glob("true_*.txt", root_dir=input_files_dir)
files_to_test = os.listdir(input_files_dir)

for file_to_test in files_to_test:
is_utf8 = workbench_utils.file_is_utf8(
os.path.join(input_files_dir, file_to_test)
)
self.assertEqual(is_utf8, True)
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)

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")
files_to_test = glob.glob("false_*.txt", root_dir=input_files_dir)
files_to_test = os.listdir(input_files_dir)

for file_to_test in files_to_test:
is_utf8 = workbench_utils.file_is_utf8(
os.path.join(input_files_dir, file_to_test)
)
self.assertEqual(is_utf8, False)
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)


if __name__ == "__main__":
Expand Down

0 comments on commit 382fed7

Please sign in to comment.