Skip to content

Commit 1717088

Browse files
committed
Fix default argument name and missing type
1 parent 5bd6f08 commit 1717088

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/test_properties.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def test_instantiation_with_type():
6666
"""
6767

6868
class BasicThing(Thing):
69-
prop = ThingProperty[bool](default=False)
69+
prop = ThingProperty[bool](initial_value=False)
7070

7171
assert issubclass(BasicThing.prop.model, BaseModel)
7272

@@ -75,17 +75,17 @@ def test_instantiation_with_type_and_model():
7575
"""If a model is specified, we check it matches the inferred type."""
7676

7777
class BasicThing(Thing):
78-
prop = ThingProperty[bool](model=bool, default=False)
78+
prop = ThingProperty[bool](model=bool, initial_value=False)
7979

8080
with pytest.raises(MismatchedTypeError):
8181

8282
class InvalidThing(Thing):
83-
prop = ThingProperty[bool](model=int, default=False)
83+
prop = ThingProperty[bool](model=int, initial_value=False)
8484

8585
with pytest.raises(MissingTypeError):
8686

8787
class InvalidThing(Thing):
88-
prop = ThingProperty(model=bool, default=False)
88+
prop = ThingProperty(model=bool, initial_value=False)
8989

9090

9191
def test_missing_default():
@@ -100,7 +100,7 @@ def test_annotation_on_class():
100100
"""Test that a type annotation on the attribute is picked up."""
101101

102102
class BasicThing(Thing):
103-
prop: bool = ThingProperty(default=False)
103+
prop: bool = ThingProperty(initial_value=False)
104104

105105
assert isinstance(BasicThing.prop, ThingProperty)
106106
assert BasicThing.prop._value_type is bool
@@ -114,7 +114,7 @@ class InvalidThing(Thing):
114114
def get_prop(self) -> bool:
115115
return False
116116

117-
prop = ThingProperty[bool](default=False, getter=get_prop)
117+
prop = ThingProperty[bool](initial_value=False, getter=get_prop)
118118

119119

120120
def test_instantiation_with_model():
@@ -123,7 +123,7 @@ class MyModel(BaseModel):
123123
b: float = 2.0
124124

125125
class BasicThing(Thing):
126-
prop = ThingProperty(MyModel, MyModel())
126+
prop = ThingProperty[MyModel](initial_value=MyModel())
127127

128128
assert BasicThing.prop.model is MyModel
129129

0 commit comments

Comments
 (0)