experimental str support in VariableParameter

This commit is contained in:
Benoît Sierro
2024-01-16 13:31:21 +01:00
parent 4f0c9a899d
commit 4e22d70193
2 changed files with 22 additions and 3 deletions

View File

@@ -94,6 +94,21 @@ def test_constant_number():
conf.y(1)
def test_non_numbers():
@vdataclass
class Conf:
x: Variable = vfield(default=["Hello", "World"])
y: Variable = vfield()
conf = Conf(y=("a", "b", "c"))
assert conf.x(0) == "Hello"
assert conf.y(0) == "a"
assert conf.y(1) == "b"
assert conf.y(2) == "c"
assert conf.x(3) == "World"
def test_constant_list():
"""classes with constant fields don't increase size and always return the constant"""