Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 887a890

Browse files
author
Andy Landy
committedFeb 19, 2025·
fix actions
1 parent 708d164 commit 887a890

19 files changed

+26
-17
lines changed
 

‎tests/dummies.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ class SuperDict(dict):
5353
pass
5454

5555

56+
class SuperSet(set):
57+
def __iter__(self):
58+
return iter(sorted(super().__iter__(), key=hash))
59+
60+
5661
class HasNoStr:
5762
f1 = 'one'
5863

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
set()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[1, 2.0, 'three', HasStr-with-f2-two-f3-three, tests.dummies.A(f1=[tests.dummies.HasNoStr(f2='two', f3='three'), True, 4], f2={5: {tests.dummies.A(f1=6, f2=7), None, HasStr-with-f2-two-f3-three}, 8: -9})]
1+
[1, 2.0, 'three', HasStr-with-f2-two-f3-three, tests.dummies.A(f1=[tests.dummies.HasNoStr(f2='two', f3='three'), True, 4], f2={5: tests.dummies.SuperSet{None, HasStr-with-f2-two-f3-three, tests.dummies.A(f1=6, f2=7)}, 8: -9})]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
set()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
set()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
set()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
set()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
set()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
set()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
...
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
...
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
...
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
set()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
set()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
set()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
...ee'), True, 4], f2={5: {tests.dummies.A(f1=6, f2=7), None, HasStr-with-f2-two-f3-three}, 8: -9})]
1+
... tests.dummies.SuperSet{None, HasStr-with-f2-two-f3-three, tests.dummies.A(f1=6, f2=7)}, 8: -9})]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[1, 2.0, 'three', HasStr-with-f2-two-f3-three, tests.dummies.A(f1=[...ith-f2-two-f3-three}, 8: -9})]
1+
[1, 2.0, 'three', HasStr-with-f2-two-f3-three, tests.dummies.A(f1=[...mmies.A(f1=6, f2=7)}, 8: -9})]

‎tests/test_fast_capped_str_casts.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
HasStr,
2424
SuperDict,
2525
SuperList,
26+
SuperSet,
2627
Unprintable,
2728
f,
2829
)
@@ -69,7 +70,7 @@ def get_len(obj):
6970
# opened file
7071
# Path
7172
# ? todo more
72-
[1, 2.0, 'three', HasStr(), A([HasNoStr(), True, 4], {5: {HasStr(), A(6, 7), None}, 8:-9})],
73+
[1, 2.0, 'three', HasStr(), A([HasNoStr(), True, 4], {5: SuperSet([HasStr(), A(6, 7), None]), 8:-9})],
7374
SuperList([11, 12, 13]),
7475
SuperDict([('k1', 'v1'), ('k2', 'v2'), ('k3', 'v3')]),
7576
Decimal('12.34'),

‎traceback_with_variables/fast_capped_str_casts.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ def fill_tokens(obj: Any, info: TokensInfo, reverse: bool, obj_depth: int) -> No
8989
elif isinstance(obj, tuple):
9090
open_token, close_token = '(', ')'
9191
else:
92+
if len(obj) == 0:
93+
info.add_token(type_to_str(type_) + '()') # i.e. 'set()', not '{}'
94+
return
9295
open_token, close_token = '{', '}'
9396
type_token = type_to_str(type_) if type_ not in {list, tuple, set} else ''
9497

0 commit comments

Comments
 (0)
Please sign in to comment.