Skip to content

Commit 541d7b4

Browse files
committed
Fix tests
1 parent 846dc56 commit 541d7b4

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

tests/test_path_nodes.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def test_path_load_save_string_file(tmp_path):
4141
# Test loading the string back
4242
load_node = PathLoadStringFile()
4343
loaded_string = load_node.load_text(file_path)
44-
assert loaded_string == (test_string,)
44+
assert loaded_string == (test_string, True)
4545

4646
# Test creating directories when saving
4747
nested_path = str(tmp_path / "nested" / "dir" / "test.txt")
@@ -52,12 +52,10 @@ def test_path_load_save_string_file(tmp_path):
5252
utf8_text = "UTF-8 text with special chars: 你好, ñ, é, ö"
5353
utf8_path = str(tmp_path / "utf8_test.txt")
5454
assert save_node.save_text(utf8_text, utf8_path, encoding="utf-8") == (True,)
55-
assert load_node.load_text(utf8_path) == (utf8_text,)
55+
assert load_node.load_text(utf8_path) == (utf8_text, True)
5656

5757
# Test error handling
58-
with pytest.raises(FileNotFoundError):
59-
load_node.load_text(str(tmp_path / "nonexistent.txt"))
60-
58+
assert load_node.load_text(str(tmp_path / "nonexistent.txt")) == ("", False)
6159

6260

6361
def test_path_abspath():
@@ -304,7 +302,7 @@ def mock_extract_mask_from_greyscale(img):
304302

305303
# Verify the mask shape
306304
assert isinstance(alpha_mask, tuple)
307-
assert len(alpha_mask) == 1
305+
assert len(alpha_mask) == 2
308306
assert isinstance(alpha_mask[0], torch.Tensor)
309307
assert alpha_mask[0].shape == (1, img_size[1], img_size[0])
310308

@@ -314,7 +312,7 @@ def mock_extract_mask_from_greyscale(img):
314312

315313
# Verify the mask shape
316314
assert isinstance(gray_mask, tuple)
317-
assert len(gray_mask) == 1
315+
assert len(gray_mask) == 2
318316
assert isinstance(gray_mask[0], torch.Tensor)
319317
assert gray_mask[0].shape == (1, img_size[1], img_size[0])
320318

@@ -352,7 +350,7 @@ def mock_extract_mask_from_alpha(img):
352350

353351
# Test loading an image with alpha
354352
load_node = PathLoadImageRGBA()
355-
loaded_img, loaded_mask = load_node.load_image_rgba(img_path)
353+
loaded_img, loaded_mask, success = load_node.load_image_rgba(img_path)
356354

357355
# Verify that the returned objects are tensors with the right shapes
358356
assert isinstance(loaded_img, torch.Tensor)
@@ -410,7 +408,7 @@ def mock_load_image_helper(path):
410408

411409
# Verify that the returned object is a tensor with the right shape
412410
assert isinstance(loaded_img, tuple)
413-
assert len(loaded_img) == 1
411+
assert len(loaded_img) == 2
414412
assert isinstance(loaded_img[0], torch.Tensor)
415413
assert loaded_img[0].shape == (1, img_size[1], img_size[0], 3) # (batch, height, width, channels)
416414

0 commit comments

Comments
 (0)