mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-07-05 06:47:08 +08:00
Support python versions lower than 3.11
This commit is contained in:
parent
ad43d4c729
commit
9af17fd650
@ -1,6 +1,5 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from comfy_execution.validation import validate_node_input
|
from comfy_execution.validation import validate_node_input
|
||||||
from enum import StrEnum
|
|
||||||
|
|
||||||
|
|
||||||
def test_exact_match():
|
def test_exact_match():
|
||||||
@ -66,12 +65,9 @@ def test_non_string():
|
|||||||
assert not validate_node_input(obj1, obj2)
|
assert not validate_node_input(obj1, obj2)
|
||||||
|
|
||||||
|
|
||||||
class NotEqualsOverrideTest(StrEnum):
|
class NotEqualsOverrideTest(str):
|
||||||
"""Test class for ``__ne__`` override."""
|
"""Test class for ``__ne__`` override."""
|
||||||
|
|
||||||
ANY = "*"
|
|
||||||
LONGER_THAN_2 = "LONGER_THAN_2"
|
|
||||||
|
|
||||||
def __ne__(self, value: object) -> bool:
|
def __ne__(self, value: object) -> bool:
|
||||||
if self == "*" or value == "*":
|
if self == "*" or value == "*":
|
||||||
return False
|
return False
|
||||||
@ -82,7 +78,7 @@ class NotEqualsOverrideTest(StrEnum):
|
|||||||
|
|
||||||
def test_ne_override():
|
def test_ne_override():
|
||||||
"""Test ``__ne__`` any override"""
|
"""Test ``__ne__`` any override"""
|
||||||
any = NotEqualsOverrideTest.ANY
|
any = NotEqualsOverrideTest("*")
|
||||||
invalid_type = "INVALID_TYPE"
|
invalid_type = "INVALID_TYPE"
|
||||||
obj = object()
|
obj = object()
|
||||||
assert validate_node_input(any, any)
|
assert validate_node_input(any, any)
|
||||||
@ -95,7 +91,7 @@ def test_ne_override():
|
|||||||
|
|
||||||
def test_ne_custom_override():
|
def test_ne_custom_override():
|
||||||
"""Test ``__ne__`` custom override"""
|
"""Test ``__ne__`` custom override"""
|
||||||
special = NotEqualsOverrideTest.LONGER_THAN_2
|
special = NotEqualsOverrideTest("LONGER_THAN_2")
|
||||||
|
|
||||||
assert validate_node_input(special, special)
|
assert validate_node_input(special, special)
|
||||||
assert validate_node_input(special, "*")
|
assert validate_node_input(special, "*")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user