Skip to content

Commit 10dd33a

Browse files
committed
switch ' = ' > ': ' in output
1 parent 9fe3c5b commit 10dd33a

File tree

3 files changed

+35
-35
lines changed

3 files changed

+35
-35
lines changed

devtools/debug.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(self, value, *, name=None, **extra):
3333
def str(self, colours=False) -> str:
3434
s = ''
3535
if self.name:
36-
s = sformat(self.name, sformat.blue, apply=colours) + ' = '
36+
s = sformat(self.name, sformat.blue, apply=colours) + ': '
3737
s += pformat(self.value, indent=2)
3838
suffix = (
3939
' ({0.value.__class__.__name__}) {1}'

tests/test_expr_render.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_simple():
1717
# print(s)
1818
assert (
1919
'tests/test_expr_render.py:<line no> test_simple\n'
20-
' len(a) = 3 (int)'
20+
' len(a): 3 (int)'
2121
) == s
2222

2323

@@ -41,20 +41,20 @@ def test_exotic_types():
4141
# list and generator comprehensions are wrong because ast is wrong, see https://bugs.python.org/issue31241
4242
assert (
4343
"tests/test_expr_render.py:<line no> test_exotic_types\n"
44-
" sum(aa) = 6 (int)\n"
45-
" 1 == 2 = False (bool)\n"
46-
" 1 < 2 = True (bool)\n"
47-
" 1 << 2 = 4 (int)\n"
48-
" 't' if True else 'f' = 't' (str) len=1\n"
49-
" 1 or 2 = 1 (int)\n"
50-
" [a for a in aa] = [1, 2, 3] (list)\n"
51-
" {a for a in aa} = {1, 2, 3} (set)\n"
52-
" {a: a + 1 for a in aa} = {\n"
44+
" sum(aa): 6 (int)\n"
45+
" 1 == 2: False (bool)\n"
46+
" 1 < 2: True (bool)\n"
47+
" 1 << 2: 4 (int)\n"
48+
" 't' if True else 'f': 't' (str) len=1\n"
49+
" 1 or 2: 1 (int)\n"
50+
" [a for a in aa]: [1, 2, 3] (list)\n"
51+
" {a for a in aa}: {1, 2, 3} (set)\n"
52+
" {a: a + 1 for a in aa}: {\n"
5353
" 1: 2,\n"
5454
" 2: 3,\n"
5555
" 3: 4,\n"
5656
" } (dict)\n"
57-
" (a for a in aa) = (\n"
57+
" (a for a in aa): (\n"
5858
" 1,\n"
5959
" 2,\n"
6060
" 3,\n"
@@ -69,7 +69,7 @@ def test_newline():
6969
# print(s)
7070
assert (
7171
'tests/test_expr_render.py:<line no> test_newline\n'
72-
' foobar(1, 2, 3) = 6 (int)'
72+
' foobar(1, 2, 3): 6 (int)'
7373
) == s
7474

7575

@@ -81,7 +81,7 @@ def test_trailing_bracket():
8181
# print(s)
8282
assert (
8383
'tests/test_expr_render.py:<line no> test_trailing_bracket\n'
84-
' foobar(1, 2, 3) = 6 (int)'
84+
' foobar(1, 2, 3): 6 (int)'
8585
) == s
8686

8787

@@ -95,7 +95,7 @@ def test_multiline():
9595
# print(s)
9696
assert (
9797
'tests/test_expr_render.py:<line no> test_multiline\n'
98-
' foobar(1, 2, 3) = 6 (int)'
98+
' foobar(1, 2, 3): 6 (int)'
9999
) == s
100100

101101

@@ -107,7 +107,7 @@ def test_multiline_trailing_bracket():
107107
# print(s)
108108
assert (
109109
'tests/test_expr_render.py:<line no> test_multiline_trailing_bracket\n'
110-
' foobar(1, 2, 3 ) = 6 (int)'
110+
' foobar(1, 2, 3 ): 6 (int)'
111111
) == s
112112

113113

@@ -121,9 +121,9 @@ def test_kwargs():
121121
s = re.sub(':\d{2,}', ':<line no>', str(v))
122122
assert (
123123
'tests/test_expr_render.py:<line no> test_kwargs\n'
124-
' foobar(1, 2, 3) = 6 (int)\n'
125-
' a = 6 (int)\n'
126-
' b = 7 (int)'
124+
' foobar(1, 2, 3): 6 (int)\n'
125+
' a: 6 (int)\n'
126+
' b: 7 (int)'
127127
) == s
128128

129129

@@ -138,9 +138,9 @@ def test_kwargs_multiline():
138138
s = re.sub(':\d{2,}', ':<line no>', str(v))
139139
assert (
140140
'tests/test_expr_render.py:<line no> test_kwargs_multiline\n'
141-
' foobar(1, 2, 3) = 6 (int)\n'
142-
' a = 6 (int)\n'
143-
' b = 7 (int)'
141+
' foobar(1, 2, 3): 6 (int)\n'
142+
' a: 6 (int)\n'
143+
' b: 7 (int)'
144144
) == s
145145

146146

@@ -152,7 +152,7 @@ def test_multiple_trailing_lines():
152152
)
153153
s = re.sub(':\d{2,}', ':<line no>', str(v))
154154
assert (
155-
'tests/test_expr_render.py:<line no> test_multiple_trailing_lines\n foobar( 1, 2, 3 ) = 6 (int)'
155+
'tests/test_expr_render.py:<line no> test_multiple_trailing_lines\n foobar( 1, 2, 3 ): 6 (int)'
156156
) == s
157157

158158

tests/test_main.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def test_print(capsys):
1717
print(stdout)
1818
assert re.sub(':\d{2,}', ':<line no>', stdout) == (
1919
'tests/test_main.py:<line no> test_print\n'
20-
' a = 1 (int)\n'
21-
' b = 2 (int)\n'
20+
' a: 1 (int)\n'
21+
' b: 2 (int)\n'
2222
)
2323
assert stderr == ''
2424

@@ -31,8 +31,8 @@ def test_format():
3131
print(repr(s))
3232
assert s == (
3333
"tests/test_main.py:<line no> test_format\n"
34-
" a = b'i might bite' (bytes) len=12\n"
35-
" b = 'hello this is a test' (str) len=20"
34+
" a: b'i might bite' (bytes) len=12\n"
35+
" b: 'hello this is a test' (str) len=20"
3636
)
3737

3838

@@ -57,10 +57,10 @@ def test_func(v):
5757
assert p.stdout.replace(str(f), '/path/to/test.py') == (
5858
"running debug...\n"
5959
"/path/to/test.py:8 <module>\n"
60-
" foobar = 'hello world' (str) len=11\n"
60+
" foobar: 'hello world' (str) len=11\n"
6161
"/path/to/test.py:4 test_func\n"
6262
" 'in test func' (str) len=12\n"
63-
" v = 42 (int)\n"
63+
" v: 42 (int)\n"
6464
"debug run.\n"
6565
)
6666

@@ -112,8 +112,8 @@ def test_kwargs():
112112
print(s)
113113
assert s == (
114114
"tests/test_main.py:<line no> test_kwargs\n"
115-
" first = 'variable' (str) len=8 variable=a\n"
116-
" second = 'literal' (str) len=7"
115+
" first: 'variable' (str) len=8 variable=a\n"
116+
" second: 'literal' (str) len=7"
117117
)
118118

119119

@@ -124,8 +124,8 @@ def test_kwargs_orderless():
124124
s = re.sub(':\d{2,}', ':<line no>', str(v))
125125
assert set(s.split('\n')) == {
126126
"tests/test_main.py:<line no> test_kwargs_orderless",
127-
" first = 'variable' (str) len=8 variable=a",
128-
" second = 'literal' (str) len=7",
127+
" first: 'variable' (str) len=8 variable=a",
128+
" second: 'literal' (str) len=7",
129129
}
130130

131131

@@ -153,7 +153,7 @@ class Bar:
153153

154154
b = Bar()
155155
v = debug.format(b.y.x)
156-
assert 'test_attributes\n b.y.x = 1 (int)' in str(v)
156+
assert 'test_attributes\n b.y.x: 1 (int)' in str(v)
157157

158158

159159
def test_eval():
@@ -181,7 +181,7 @@ def test_eval_kwargs():
181181
assert str(v) == (
182182
"<string>:1 <module>\n"
183183
" 1 (int)\n"
184-
" apple = 'pear' (str) len=4"
184+
" apple: 'pear' (str) len=4"
185185
)
186186

187187

0 commit comments

Comments
 (0)