peek-python 25.0.26__tar.gz → 25.0.27__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {peek_python-25.0.26 → peek_python-25.0.27}/PKG-INFO +1 -1
- {peek_python-25.0.26 → peek_python-25.0.27}/peek/peek.py +2 -2
- {peek_python-25.0.26 → peek_python-25.0.27}/peek_python.egg-info/PKG-INFO +1 -1
- {peek_python-25.0.26 → peek_python-25.0.27}/pyproject.toml +1 -1
- {peek_python-25.0.26 → peek_python-25.0.27}/tests/test_peek.py +16 -18
- {peek_python-25.0.26 → peek_python-25.0.27}/README.md +0 -0
- {peek_python-25.0.26 → peek_python-25.0.27}/peek/__init__.py +0 -0
- {peek_python-25.0.26 → peek_python-25.0.27}/peek_python.egg-info/SOURCES.txt +0 -0
- {peek_python-25.0.26 → peek_python-25.0.27}/peek_python.egg-info/dependency_links.txt +0 -0
- {peek_python-25.0.26 → peek_python-25.0.27}/peek_python.egg-info/requires.txt +0 -0
- {peek_python-25.0.26 → peek_python-25.0.27}/peek_python.egg-info/top_level.txt +0 -0
- {peek_python-25.0.26 → peek_python-25.0.27}/setup.cfg +0 -0
|
@@ -34,7 +34,7 @@ import pprint
|
|
|
34
34
|
import builtins
|
|
35
35
|
import shutil
|
|
36
36
|
|
|
37
|
-
__version__ = "25.0.
|
|
37
|
+
__version__ = "25.0.27"
|
|
38
38
|
|
|
39
39
|
from pathlib import Path
|
|
40
40
|
|
|
@@ -473,7 +473,7 @@ class _Peek:
|
|
|
473
473
|
if filename not in _Peek.codes:
|
|
474
474
|
frame_info = inspect.getframeinfo(call_frame, context=1000000) # get the full source code
|
|
475
475
|
if frame_info.code_context is None:
|
|
476
|
-
_Peek.
|
|
476
|
+
_Peek.codes[filename] = ""
|
|
477
477
|
else:
|
|
478
478
|
_Peek.codes[filename] = frame_info.code_context
|
|
479
479
|
|
|
@@ -10,10 +10,9 @@ import shutil
|
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
sys.path.insert(0,
|
|
16
|
-
os.chdir(file_folder)
|
|
13
|
+
import os, sys # three lines to use the local package and chdir
|
|
14
|
+
os.chdir(os.path.dirname(__file__))
|
|
15
|
+
sys.path.insert(0, os.path.dirname(__file__) + "/../" + os.path.dirname(__file__).split(os.sep)[-2])
|
|
17
16
|
|
|
18
17
|
import peek
|
|
19
18
|
|
|
@@ -37,11 +36,6 @@ cyan=peek.ANSI.cyan
|
|
|
37
36
|
white=peek.ANSI.white
|
|
38
37
|
reset=peek.ANSI.reset
|
|
39
38
|
|
|
40
|
-
class g:
|
|
41
|
-
pass
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
context_start = "#"
|
|
45
39
|
|
|
46
40
|
Pythonista = sys.platform == "ios"
|
|
47
41
|
|
|
@@ -67,7 +61,7 @@ def test_time(patch_datetime_now):
|
|
|
67
61
|
def test_no_arguments(capsys):
|
|
68
62
|
result = peek()
|
|
69
63
|
out, err = capsys.readouterr()
|
|
70
|
-
assert out.startswith(
|
|
64
|
+
assert out.startswith("#")
|
|
71
65
|
assert out.endswith(" in test_no_arguments()\n")
|
|
72
66
|
assert result is None
|
|
73
67
|
|
|
@@ -107,7 +101,7 @@ def test_in_function(capsys):
|
|
|
107
101
|
|
|
108
102
|
hello("world")
|
|
109
103
|
out, err = capsys.readouterr()
|
|
110
|
-
assert out.startswith(
|
|
104
|
+
assert out.startswith("#")
|
|
111
105
|
assert out.endswith(" in test_in_function.hello() ==> val='world'\n")
|
|
112
106
|
|
|
113
107
|
|
|
@@ -117,7 +111,7 @@ def test_in_function_no_parent(capsys):
|
|
|
117
111
|
|
|
118
112
|
hello("world")
|
|
119
113
|
out, err = capsys.readouterr()
|
|
120
|
-
assert out.startswith(
|
|
114
|
+
assert out.startswith("#")
|
|
121
115
|
assert not out.endswith(" in test_in_function_no_parent.hello() ==> val='world'\n")
|
|
122
116
|
|
|
123
117
|
|
|
@@ -142,11 +136,12 @@ def test_time_delta():
|
|
|
142
136
|
|
|
143
137
|
|
|
144
138
|
def test_dynamic_prefix(capsys):
|
|
145
|
-
|
|
139
|
+
i = 0
|
|
146
140
|
|
|
147
141
|
def prefix():
|
|
148
|
-
|
|
149
|
-
|
|
142
|
+
nonlocal i
|
|
143
|
+
i += 1
|
|
144
|
+
return str(i) + ")"
|
|
150
145
|
|
|
151
146
|
hello = "world"
|
|
152
147
|
peek(hello, prefix=prefix)
|
|
@@ -209,10 +204,11 @@ def test_repr_and_str(capsys):
|
|
|
209
204
|
|
|
210
205
|
|
|
211
206
|
def test_output(capsys, tmpdir):
|
|
212
|
-
|
|
207
|
+
result = ""
|
|
213
208
|
|
|
214
209
|
def my_output(s):
|
|
215
|
-
|
|
210
|
+
nonlocal result
|
|
211
|
+
result += s
|
|
216
212
|
|
|
217
213
|
hello = "world"
|
|
218
214
|
peek(hello, output=print)
|
|
@@ -271,7 +267,7 @@ def test_output(capsys, tmpdir):
|
|
|
271
267
|
out, err = capsys.readouterr()
|
|
272
268
|
assert out == ""
|
|
273
269
|
assert out == ""
|
|
274
|
-
assert
|
|
270
|
+
assert result == "hello='world'\n1\n"
|
|
275
271
|
|
|
276
272
|
def test_serialize(capsys):
|
|
277
273
|
def serialize(s):
|
|
@@ -320,6 +316,7 @@ def test_as_str():
|
|
|
320
316
|
assert s == "hello='world'\n"
|
|
321
317
|
|
|
322
318
|
|
|
319
|
+
@pytest.mark.skipif(Pythonista, reason="Pythonista problem")
|
|
323
320
|
def test_colored_end(capsys):
|
|
324
321
|
hello = "world"
|
|
325
322
|
s = peek(hello, color="red", end="|", as_str=True)
|
|
@@ -1212,6 +1209,7 @@ hello='world'
|
|
|
1212
1209
|
)
|
|
1213
1210
|
|
|
1214
1211
|
|
|
1212
|
+
@pytest.mark.skipif(Pythonista, reason="Pythonista problem")
|
|
1215
1213
|
def test_stop():
|
|
1216
1214
|
with pytest.raises(SystemExit):
|
|
1217
1215
|
peek.stop()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|