Show More
@@ -17,9 +17,10 b' import math' | |||||
17 | import random |
|
17 | import random | |
18 | import sys |
|
18 | import sys | |
19 |
|
19 | |||
20 | import nose.tools as nt |
|
|||
21 | from pathlib import Path |
|
20 | from pathlib import Path | |
22 |
|
21 | |||
|
22 | import pytest | |||
|
23 | ||||
23 | from IPython.utils import text |
|
24 | from IPython.utils import text | |
24 |
|
25 | |||
25 | #----------------------------------------------------------------------------- |
|
26 | #----------------------------------------------------------------------------- | |
@@ -116,8 +117,9 b' def eval_formatter_check(f):' | |||||
116 | assert s == ns["u"] |
|
117 | assert s == ns["u"] | |
117 | # This decodes in a platform dependent manner, but it shouldn't error out |
|
118 | # This decodes in a platform dependent manner, but it shouldn't error out | |
118 | s = f.format("{b}", **ns) |
|
119 | s = f.format("{b}", **ns) | |
119 |
|
120 | |||
120 |
|
|
121 | pytest.raises(NameError, f.format, "{dne}", **ns) | |
|
122 | ||||
121 |
|
123 | |||
122 | def eval_formatter_slicing_check(f): |
|
124 | def eval_formatter_slicing_check(f): | |
123 | ns = dict(n=12, pi=math.pi, stuff='hello there', os=os) |
|
125 | ns = dict(n=12, pi=math.pi, stuff='hello there', os=os) | |
@@ -128,7 +130,7 b' def eval_formatter_slicing_check(f):' | |||||
128 | s = f.format("{stuff[::2]}", **ns) |
|
130 | s = f.format("{stuff[::2]}", **ns) | |
129 | assert s == ns["stuff"][::2] |
|
131 | assert s == ns["stuff"][::2] | |
130 |
|
132 | |||
131 |
|
|
133 | pytest.raises(SyntaxError, f.format, "{n:x}", **ns) | |
132 |
|
134 | |||
133 | def eval_formatter_no_slicing_check(f): |
|
135 | def eval_formatter_no_slicing_check(f): | |
134 | ns = dict(n=12, pi=math.pi, stuff='hello there', os=os) |
|
136 | ns = dict(n=12, pi=math.pi, stuff='hello there', os=os) | |
@@ -194,7 +196,7 b' def test_LSString():' | |||||
194 | assert lss.l == ["abc", "def"] |
|
196 | assert lss.l == ["abc", "def"] | |
195 | assert lss.s == "abc def" |
|
197 | assert lss.s == "abc def" | |
196 | lss = text.LSString(os.getcwd()) |
|
198 | lss = text.LSString(os.getcwd()) | |
197 |
|
|
199 | assert isinstance(lss.p[0], Path) | |
198 |
|
200 | |||
199 | def test_SList(): |
|
201 | def test_SList(): | |
200 | sl = text.SList(["a 11", "b 1", "a 2"]) |
|
202 | sl = text.SList(["a 11", "b 1", "a 2"]) |
General Comments 0
You need to be logged in to leave comments.
Login now