From 2d2d625ed0d7c6de0c86a64ddeb0e432542815c8 Mon Sep 17 00:00:00 2001 From: Benjamin Berman Date: Wed, 29 Oct 2025 05:26:10 -0700 Subject: [PATCH] Fix unit tests (no code changes, no re-release) --- .../fsspec_tests/test_package_filesystem.py | 12 ++---------- tests/unit/test_regular_expression_nodes.py | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/tests/unit/fsspec_tests/test_package_filesystem.py b/tests/unit/fsspec_tests/test_package_filesystem.py index 6038a99ee..0fda8cfae 100644 --- a/tests/unit/fsspec_tests/test_package_filesystem.py +++ b/tests/unit/fsspec_tests/test_package_filesystem.py @@ -105,16 +105,8 @@ def test_load_font_with_upath(pkg_fs): # UPath will use the registered fsspec filesystem for "pkg" font_path = UPath("pkg://comfy.fonts/Tiny5-Regular.ttf") - # Try to load the font by passing the UPath object directly. - # This is not expected to work for non-local paths unless the consuming - # library (Pillow) has specific support for fsspec/upath. - try: - font = ImageFont.truetype(font_path, 10) - except (TypeError, AttributeError): - # If passing the path directly fails, fall back to opening the file - # and passing the file-like object, which is the standard way. - with font_path.open("rb") as f: - font = ImageFont.truetype(f, 10) + with font_path.open("rb") as f: + font = ImageFont.truetype(f, 10) assert font is not None assert isinstance(font, ImageFont.FreeTypeFont) diff --git a/tests/unit/test_regular_expression_nodes.py b/tests/unit/test_regular_expression_nodes.py index bacd2801b..4ab805ec5 100644 --- a/tests/unit/test_regular_expression_nodes.py +++ b/tests/unit/test_regular_expression_nodes.py @@ -29,18 +29,19 @@ def test_regex(): n = Regex() # Basic match test - match, = n.execute(pattern=r"hello", string="hello world") + match, *_ = n.execute(pattern=r"hello", string="hello world") assert match is not None assert match.group(0) == "hello" # Test with flags - match, = n.execute(pattern=r"HELLO", string="hello world", flags=re.IGNORECASE) + match, *_ = n.execute(pattern=r"HELLO", string="hello world", flags=re.IGNORECASE) assert match is not None assert match.group(0) == "hello" # Test no match - match, = n.execute(pattern=r"python", string="hello world") + match, has_match = n.execute(pattern=r"python", string="hello world") assert match is None + assert not has_match def test_regex_match_group_by_index(): @@ -48,7 +49,7 @@ def test_regex_match_group_by_index(): regex = Regex() # Test basic group - match, = regex.execute(pattern=r"(hello) (world)", string="hello world") + match, *_ = regex.execute(pattern=r"(hello) (world)", string="hello world") group, = n.execute(match=match, index=0) assert group == "hello world" @@ -64,8 +65,8 @@ def test_regex_match_group_by_name(): regex = Regex() # Test named group - match, = regex.execute(pattern=r"(?Phello) (?Pworld)", - string="hello world") + match, *_ = regex.execute(pattern=r"(?Phello) (?Pworld)", + string="hello world") group, = n.execute(match=match, name="greeting") assert group == "hello" @@ -83,12 +84,12 @@ def test_regex_match_expand(): regex = Regex() # Test basic expansion - match, = regex.execute(pattern=r"(hello) (world)", string="hello world") + match, *_ = regex.execute(pattern=r"(hello) (world)", string="hello world") result, = n.execute(match=match, template=r"\2, \1!") assert result == "world, hello!" # Test named group expansion - match, = regex.execute(pattern=r"(?Phello) (?Pworld)", - string="hello world") + match, *_ = regex.execute(pattern=r"(?Phello) (?Pworld)", + string="hello world") result, = n.execute(match=match, template=r"\g, \g!") assert result == "world, hello!"