Skip to content

Commit 1c41e1c

Browse files
committed
fix tests
1 parent 13cc71a commit 1c41e1c

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/idom/core/hooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def should_render(self, new: ContextProvider[_StateType]) -> bool:
323323
return False
324324

325325
def __repr__(self) -> str:
326-
return f"{type(self).__name__}({self.type!r})"
326+
return f"{type(self).__name__}({self.type})"
327327

328328

329329
_ActionType = TypeVar("_ActionType")

tests/test_core/test_hooks.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -934,9 +934,8 @@ def ComponentUsesContext():
934934

935935

936936
def test_context_repr():
937-
sample_context = idom.Context("sample_context", None)
938-
assert repr(sample_context) == "Context('sample_context')"
939-
assert repr(sample_context()) == "ContextProvider('sample_context')"
937+
sample_context = idom.create_context(None)
938+
assert repr(sample_context()) == f"ContextProvider({sample_context})"
940939

941940

942941
async def test_use_context_only_renders_for_value_change():
@@ -1065,8 +1064,8 @@ def Inner():
10651064

10661065

10671066
async def test_neighboring_contexts_do_not_conflict():
1068-
LeftContext = idom.create_context(None, name="Left")
1069-
RightContext = idom.create_context(None, name="Right")
1067+
LeftContext = idom.create_context(None)
1068+
RightContext = idom.create_context(None)
10701069

10711070
set_left = idom.Ref()
10721071
set_right = idom.Ref()
@@ -1249,7 +1248,7 @@ def SomeComponent():
12491248
async def test_conditionally_rendered_components_can_use_context():
12501249
set_state = idom.Ref()
12511250
used_context_values = []
1252-
some_context = idom.create_context("some_context", None)
1251+
some_context = idom.create_context(None)
12531252

12541253
@idom.component
12551254
def SomeComponent():

0 commit comments

Comments
 (0)