File tree Expand file tree Collapse file tree 2 files changed +12
-18
lines changed Expand file tree Collapse file tree 2 files changed +12
-18
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
33import asyncio
4+ import contextlib
45from collections .abc import Coroutine , MutableMapping , Sequence
56from logging import getLogger
67from types import FunctionType
@@ -517,18 +518,11 @@ def strictly_equal(x: Any, y: Any) -> bool:
517518 - ``bytearray``
518519 - ``memoryview``
519520 """
520- return x is y or (type (x ) in _NUMERIC_TEXT_BINARY_TYPES and x == y )
521-
522-
523- _NUMERIC_TEXT_BINARY_TYPES = {
524- # numeric
525- int ,
526- float ,
527- complex ,
528- # text
529- str ,
530- # binary types
531- bytes ,
532- bytearray ,
533- memoryview ,
534- }
521+ if type (x ) is not type (y ):
522+ return False
523+
524+ with contextlib .suppress (Exception ):
525+ if hasattr (x , "__eq__" ):
526+ return x == y
527+
528+ return x is y
Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ def Counter():
159159 await layout .render ()
160160
161161
162- async def test_set_state_checks_identity_not_equality (display : DisplayFixture ):
162+ async def test_set_state_checks_equality_not_identity (display : DisplayFixture ):
163163 r_1 = reactpy .Ref ("value" )
164164 r_2 = reactpy .Ref ("value" )
165165
@@ -219,12 +219,12 @@ def TestComponent():
219219 await client_r_2_button .click ()
220220
221221 await poll_event_count .until_equals (2 )
222- await poll_render_count .until_equals (2 )
222+ await poll_render_count .until_equals (1 )
223223
224224 await client_r_2_button .click ()
225225
226226 await poll_event_count .until_equals (3 )
227- await poll_render_count .until_equals (2 )
227+ await poll_render_count .until_equals (1 )
228228
229229
230230async def test_simple_input_with_use_state (display : DisplayFixture ):
You can’t perform that action at this time.
0 commit comments