File tree 2 files changed +12
-18
lines changed 2 files changed +12
-18
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
3
import asyncio
4
+ import contextlib
4
5
from collections .abc import Coroutine , MutableMapping , Sequence
5
6
from logging import getLogger
6
7
from types import FunctionType
@@ -517,18 +518,11 @@ def strictly_equal(x: Any, y: Any) -> bool:
517
518
- ``bytearray``
518
519
- ``memoryview``
519
520
"""
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():
159
159
await layout .render ()
160
160
161
161
162
- async def test_set_state_checks_identity_not_equality (display : DisplayFixture ):
162
+ async def test_set_state_checks_equality_not_identity (display : DisplayFixture ):
163
163
r_1 = reactpy .Ref ("value" )
164
164
r_2 = reactpy .Ref ("value" )
165
165
@@ -219,12 +219,12 @@ def TestComponent():
219
219
await client_r_2_button .click ()
220
220
221
221
await poll_event_count .until_equals (2 )
222
- await poll_render_count .until_equals (2 )
222
+ await poll_render_count .until_equals (1 )
223
223
224
224
await client_r_2_button .click ()
225
225
226
226
await poll_event_count .until_equals (3 )
227
- await poll_render_count .until_equals (2 )
227
+ await poll_render_count .until_equals (1 )
228
228
229
229
230
230
async def test_simple_input_with_use_state (display : DisplayFixture ):
You can’t perform that action at this time.
0 commit comments