Skip to content

Commit fd71c0b

Browse files
committed
tests
1 parent f78d0ba commit fd71c0b

File tree

5 files changed

+1381
-0
lines changed

5 files changed

+1381
-0
lines changed

test/doc_tests.yaml

Lines changed: 299 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,299 @@
1+
#
2+
# These tests were automatically picked up from doc 2025-12-13
3+
# The doc-xxx numbers are simply sequential numbers in alphebatized list as of that date
4+
# Most of the tests don't have vectorized implementations, so we only test classic
5+
# Tests aimed specifically at vectorized implementations can be found in vec_tests.yaml
6+
#
7+
__DEFAULTS__:
8+
vec: False
9+
doc-001:
10+
expr: BarChart[{1, 4, 2}, ChartStyle -> {Red, Green, Blue}]
11+
doc-002:
12+
expr: BarChart[{1, 4, 2}]
13+
doc-003:
14+
expr: BarChart[{{1, 2, 3}, {2, 3, 4}}, ChartLabels -> {"a", "b", "c"}]
15+
doc-004:
16+
expr: BarChart[{{1, 2, 3}, {2, 3, 4}}]
17+
doc-005:
18+
expr: BarChart[{{1, 5}, {3, 4}}, ChartStyle -> {{EdgeForm[Thin], White}, {EdgeForm[Thick], White}}]
19+
doc-006:
20+
expr: DensityPlot[1 / x, {x, 0, 1}, {y, 0, 1}]
21+
# generating svg from this produces a lot of warnings about System`LineBox so disabling for now
22+
doc-007:
23+
expr: DensityPlot[1/(x^2 + y^2 + 1), {x, -1, 1}, {y, -2,2}, Mesh->Full]
24+
svg: false
25+
# generating svg from this produces a lot of warnings about System`LineBox so disabling for now
26+
doc-008:
27+
expr: DensityPlot[Sin[x y], {x, -2, 2}, {y, -2, 2}, Mesh->Full]
28+
svg: false
29+
doc-009:
30+
expr: DensityPlot[Sqrt[x * y], {x, -1, 1}, {y, -1, 1}]
31+
doc-010:
32+
expr: 'DensityPlot[x ^ 2 + 1 / y, {x, -1, 1}, {y, 1, 4}, ColorFunction -> (Blend[{Red, Green, Blue}, #]&)]'
33+
skip: pyodide
34+
doc-011:
35+
expr: DensityPlot[x ^ 2 + 1 / y, {x, -1, 1}, {y, 1, 4}]
36+
# generating svg from this produces a lot of warnings about System`LineBox so disabling for now
37+
doc-012:
38+
expr: DensityPlot[x^2 y, {x, -1, 1}, {y, -1, 1}, Mesh->All]
39+
skip: pyodide
40+
svg: false
41+
doc-013:
42+
expr: DiscretePlot[2.5 Sqrt[k], {k, 100}]
43+
doc-014:
44+
expr: DiscretePlot[PrimePi[k], {k, 1, 100}]
45+
doc-015:
46+
expr: DiscretePlot[{Sin[Pi x/20], Cos[Pi x/20]}, {x, 0, 40}]
47+
doc-016:
48+
expr: Histogram[{3, 8, 10, 100, 1000, 500, 300, 200, 10, 20, 200, 100, 200, 300, 500}]
49+
doc-017:
50+
expr: Histogram[{{1, 2, 10, 5, 50, 20}, {90, 100, 101, 120, 80}}]
51+
doc-018:
52+
expr: ListLinePlot[Table[Cos[x], {x, -5, 5, 0.2}], Filling->Top]
53+
doc-019:
54+
expr: ListLinePlot[Table[Sin[x], {x, -5, 5, 0.2}], Filling->Axis]
55+
doc-020:
56+
expr: ListLinePlot[Table[Sin[x], {x, -5, 5, 0.2}], Filling->Bottom]
57+
doc-021:
58+
expr: ListLinePlot[Table[{n, n ^ 0.5}, {n, 10}]]
59+
doc-022:
60+
expr: ListLinePlot[list]
61+
skip: true # malformed test - depends on list
62+
doc-023:
63+
expr: ListLinePlot[{{-2, -1}, {-1, -1}, {1, 3}}, Filling->Axis]
64+
doc-024:
65+
expr: ListLogPlot[Table[Fibonacci[n], {n, 10}]]
66+
doc-025:
67+
expr: ListLogPlot[Table[n!, {n, 10}], Joined -> True]
68+
doc-026:
69+
expr: ListPlot[Prime[Range[30]]]
70+
doc-027:
71+
expr: ListPlot[Table[ElementData[z, "AtomicWeight"], {z, 118}]]
72+
doc-028:
73+
expr: ListPlot[Table[n ^ 2 / 8, {n, 30}]]
74+
doc-029:
75+
expr: ListPlot[Table[n ^ 2, {n, 10}], Joined->True]
76+
doc-030:
77+
expr: ListPlot[Table[n ^ 2, {n, 30}], Filling->Axis]
78+
doc-031:
79+
expr: ListPlot[Table[n ^ 2, {n, 30}], Joined->True]
80+
doc-032:
81+
expr: ListPlot[ToCharacterCode["plot this string"], Filling -> Axis]
82+
doc-033:
83+
expr: ListStepPlot[{1, 1, 2, 3, 5, 8, 13, 21}, Joined->False]
84+
doc-034:
85+
expr: ListStepPlot[{1, 1, 2, 3, 5, 8, 13, 21}]
86+
doc-035:
87+
expr: ListStepPlot[{{1, 1}, {3, 2}, {4, 5}, {5, 8}, {6, 13}, {7, 21}}, Filling->Axis]
88+
doc-036:
89+
expr: LogPlot[x^x, {x, 1, 5}]
90+
doc-037:
91+
expr: LogPlot[{10^x, Factorial[x], Subfactorial[x]}, {x, 0, 25}, PlotPoints->26]
92+
doc-038:
93+
expr: LogPlot[{x^x, Exp[x], x!}, {x, 1, 5}]
94+
doc-039:
95+
expr: NumberLinePlot[Prime[Range[10]]]
96+
doc-040:
97+
expr: NumberLinePlot[Table[x^2, {x, 10}]]
98+
doc-041:
99+
expr: ParametricPlot[ {LegendreP[7, x], LegendreP[5, x]}, {x, -1, 1}]
100+
doc-042:
101+
expr: ParametricPlot[{Cos[u] / u, Sin[u] / u}, {u, 0, 50}, PlotRange->0.5]
102+
doc-043:
103+
expr: ParametricPlot[{Sin[u], Cos[3 u]}, {u, 0, 2 Pi}]
104+
doc-044:
105+
expr: ParametricPlot[{{Sin[u], Cos[u]},{0.6 Sin[u], 0.6 Cos[u]}, {0.2 Sin[u], 0.2 Cos[u]}}, {u, 0, 2 Pi}, PlotRange->1, AspectRatio->1]
106+
doc-045:
107+
expr: PieChart[{1, -1, 3}]
108+
doc-046:
109+
expr: PieChart[{30, 20, 10}, ChartLabels -> {Dogs, Cats, Fish}]
110+
doc-047:
111+
expr: PieChart[{8, 16, 2}, SectorOrigin -> {Automatic, 1.5}]
112+
doc-048:
113+
expr: PieChart[{{10, 20, 30}, {15, 22, 30}}, ChartLabels -> {A, B, C}]
114+
doc-049:
115+
expr: PieChart[{{10, 20, 30}, {15, 22, 30}}, SectorSpacing -> None]
116+
doc-050:
117+
expr: PieChart[{{10, 20, 30}, {15, 22, 30}}]
118+
# all of the classic (non-vectorized) Plot3D plots fail with the following error
119+
# TypeError: Graphics3DBox._prepare_elements() got an unexpected keyword argument 'neg_y'
120+
doc-051:
121+
expr: Plot3D[Exp[x] Cos[y], {x, -2, 1}, {y, -Pi, 2 Pi}]
122+
svg: false
123+
doc-052:
124+
expr: Plot3D[Log[x + y^2], {x, -1, 1}, {y, -1, 1}]
125+
skip: pyodide # abort exceeded iteration limit
126+
svg: false
127+
# skipping following due to significant numerical diff btw macos and ubuntu
128+
# i think the test is numerically unstable because of the / (x y)
129+
doc-053:
130+
expr: Plot3D[Sin[x y] /(x y), {x, -3, 3}, {y, -3, 3}, Mesh->All]
131+
skip: true
132+
doc-054:
133+
expr: Plot3D[Sin[x y], {x, -2, 2}, {y, -2, 2}, Mesh->Full]
134+
svg: false
135+
doc-055:
136+
expr: Plot3D[Sin[y + Sin[3 x]], {x, -2, 2}, {y, -2, 2}, PlotPoints->20]
137+
svg: false
138+
doc-056:
139+
expr: Plot3D[x / (x ^ 2 + y ^ 2 + 1), {x, -2, 2}, {y, -2, 2}, Mesh->None]
140+
svg: false
141+
doc-057:
142+
expr: Plot3D[x ^ 2 + 1 / y, {x, -1, 1}, {y, 1, 4}]
143+
svg: false
144+
doc-058:
145+
expr: Plot3D[{x^2 + y^2, -x^2 - y^2}, {x, -2, 2}, {y, -2, 2}, BoxRatios-> Automatic, Mesh->None]
146+
svg: false
147+
doc-059:
148+
# The original doctest had 3 instead of 3.1, but that would give int on some platforms
149+
# and float on others. So changed here to 3.1 to force float on all platforms.
150+
# TODO: consider making test insensitive to float vs int provided the value is the same.
151+
expr: Plot[3.1, {x, 0, 1}]
152+
skip: pyodide # pyodide emits Real 3 where other platforms emit Integer 3
153+
doc-060:
154+
expr: Plot[Abs[x], {x, -4, 4}]
155+
doc-061:
156+
expr: Plot[AiryAiPrime[x], {x, -10, 10}]
157+
doc-062:
158+
expr: Plot[AiryAi[x], {x, -10, 10}]
159+
doc-063:
160+
expr: Plot[AiryBiPrime[x], {x, -10, 2}]
161+
doc-064:
162+
expr: Plot[AiryBi[x], {x, -10, 2}]
163+
doc-065:
164+
expr: Plot[AngerJ[1, x], {x, -10, 10}]
165+
doc-066:
166+
expr: Plot[BesselI[0, x], {x, 0, 5}]
167+
doc-067:
168+
expr: Plot[BesselJ[0, x], {x, 0, 10}]
169+
doc-068:
170+
expr: Plot[BesselK[0, x], {x, 0, 5}]
171+
doc-069:
172+
expr: Plot[BesselY[0, x], {x, 0, 10}]
173+
doc-070:
174+
expr: Plot[EllipticE[m], {m, -2, 2}]
175+
doc-071:
176+
expr: Plot[EllipticK[n], {n, -1, 1}]
177+
doc-072:
178+
expr: Plot[Erf[x], {x, -2, 2}]
179+
doc-073:
180+
expr: Plot[Erfc[x], {x, -2, 2}]
181+
doc-074:
182+
expr: Plot[Evaluate[Table[x^y, {y, 1, 5}]], {x, -1.5, 1.5}, AspectRatio -> 1]
183+
doc-075:
184+
expr: Plot[Exp[x], {x, 0, 3}]
185+
doc-076:
186+
expr: Plot[Gudermannian[x], {x, -10, 10}]
187+
doc-077:
188+
expr: Plot[Hypergeometric1F1[1, 2, x], {x, -5, 5}]
189+
doc-078:
190+
expr: Plot[Hypergeometric2F1[1/3, 1/3, 2/3, x], {x, -1, 1}]
191+
doc-079:
192+
expr: Plot[HypergeometricPFQ[{1, 1}, {3, 3, 3}, x], {x, -30, 30}]
193+
doc-080:
194+
expr: Plot[HypergeometricU[3, 2, x], {x, 0.5, 10}]
195+
skip: true # hits iteration limit
196+
doc-081:
197+
expr: Plot[InverseErf[x], {x, -1, 1}]
198+
doc-082:
199+
expr: Plot[InverseGudermannian[x], {x, -2 Pi, 2 Pi}]
200+
doc-083:
201+
expr: Plot[KelvinBei[x], {x, 0, 10}]
202+
doc-084:
203+
expr: Plot[KelvinBer[x], {x, 0, 10}]
204+
doc-085:
205+
expr: Plot[KelvinKei[x], {x, 0, 10}]
206+
doc-086:
207+
expr: Plot[KelvinKer[x], {x, 0, 10}]
208+
doc-087:
209+
expr: Plot[LambertW[x], {x, -1/E, E}]
210+
doc-088:
211+
expr: Plot[LerchPhi[x, 1, 2], {x, -1, 1}]
212+
doc-089:
213+
expr: Plot[Log[x], {x, 0, 5}, MaxRecursion->0]
214+
doc-090:
215+
expr: Plot[Log[x], {x, 0, 5}]
216+
doc-091:
217+
expr: Plot[LucasL[1/2, x], {x, -5, 5}]
218+
doc-092:
219+
expr: Plot[Piecewise[{{Log[x], x > 0}, {x*-0.5, x < 0}}], {x, -1, 1}]
220+
skip: true # hits iteration limit
221+
doc-093:
222+
expr: Plot[PolyLog[2,x], {x, -20, 1}]
223+
doc-094:
224+
expr: Plot[ProductLog[x], {x, -1/E, E}]
225+
doc-095:
226+
expr: Plot[Sin[Cos[x^2]],{x,-4,4}, PlotPoints->22]
227+
doc-096:
228+
expr: Plot[Sin[Cos[x^2]],{x,-4,4}, PlotRange -> All]
229+
doc-097:
230+
expr: Plot[Sin[Cos[x^2]],{x,-4,4},Mesh->All]
231+
doc-098:
232+
expr: Plot[Sin[x], {x, -Pi, Pi}]
233+
doc-099:
234+
expr: Plot[Sin[x], {x, 0, 10}, ImageSize -> Small]
235+
doc-100:
236+
expr: Plot[Sin[x], {x, 0, 2 Pi}, Background -> LightBlue]
237+
doc-101:
238+
expr: Plot[Sin[x], {x, 0, 2 Pi}]
239+
doc-102:
240+
expr: Plot[Sin[x], {x, 0, 4 Pi}, PlotRange->{{0, 4 Pi}, {0, 1.5}}]
241+
doc-103:
242+
expr: Plot[Sin[x], {x,0,4 Pi}, Mesh->Full]
243+
doc-104:
244+
expr: Plot[SphericalBesselJ[1, x], {x, 0.1, 10}]
245+
doc-105:
246+
expr: Plot[SphericalBesselY[1, x], {x, 0, 10}]
247+
doc-106:
248+
expr: Plot[Sqrt[a^2], {a, -2, 2}]
249+
doc-107:
250+
expr: Plot[StruveH[0, x], {x, 0, 10}]
251+
doc-108:
252+
expr: Plot[StruveL[0, x], {x, 0, 5}]
253+
doc-109:
254+
expr: Plot[Tan[x], {x, -6, 6}, Mesh->Full]
255+
doc-110:
256+
expr: Plot[Tan[x], {x, 0, 6}, Mesh->All, PlotRange->{{-1, 5}, {0, 15}}, MaxRecursion->10]
257+
doc-111:
258+
expr: Plot[UnitStep[x], {x, -4, 4}]
259+
doc-112:
260+
expr: Plot[WeberE[1, x], {x, -10, 10}]
261+
doc-113:
262+
expr: Plot[Zeta[z], {z, -20, 10}]
263+
doc-114:
264+
expr: Plot[f[x], {x, -8, 6}]
265+
doc-115:
266+
expr: Plot[x^2, {x, -1, 1}, MaxRecursion->5, Mesh->All]
267+
doc-116:
268+
expr: Plot[{Cos[a], Re[E^(I a)]}, {a, 0, 2 Pi}]
269+
doc-117:
270+
expr: Plot[{Gamma[x], x!}, {x, 0, 4}]
271+
doc-118:
272+
expr: Plot[{Hypergeometric1F1[1/2, Sqrt[2], x], Hypergeometric1F1[1/2, Sqrt[3], x], Hypergeometric1F1[1/2, Sqrt[5], x]}, {x, -4, 4}]
273+
doc-119:
274+
expr: Plot[{Hypergeometric1F1[Sqrt[2], b, 1], Hypergeometric1F1[Sqrt[5], b, 1], Hypergeometric1F1[Sqrt[7], b, 1]}, {b, -3, 3}]
275+
doc-120:
276+
expr: Plot[{Hypergeometric1F1[Sqrt[3], Sqrt[2], z], -0.01}, {z, -10, -2}]
277+
doc-121:
278+
expr: Plot[{Sin[a], Im[E^(I a)]}, {a, 0, 2 Pi}]
279+
doc-122:
280+
expr: Plot[{Sin[x], Cos[x], x / 3}, {x, -Pi, Pi}, Background -> RGBColor[0.5, .5, .5, 0.1]]
281+
doc-123:
282+
expr: Plot[{Sin[x], Cos[x], x / 3}, {x, -Pi, Pi}]
283+
doc-124:
284+
expr: Plot[{Sin[x], Cos[x], x ^ 2}, {x, -1, 1}]
285+
doc-125:
286+
expr: PolarPlot[Abs[Cos[5t]], {t, 0, Pi}]
287+
doc-126:
288+
expr: PolarPlot[Cos[5t], {t, 0, Pi}]
289+
doc-127:
290+
expr: PolarPlot[Sqrt[t], {t, 0, 16 Pi}]
291+
doc-128:
292+
expr: PolarPlot[{1, 1 + Sin[20 t] / 5}, {t, 0, 2 Pi}]
293+
#
294+
# Tests with prefix "nondoc" aren't act doc tests and provide additional coverage.
295+
# We give them their own prefix to avoid collisions.
296+
# TODO: these may indicate gaps in the doctests
297+
#
298+
nondoc-plot-exclusions:
299+
expr: Plot[x, {x,0,10}, Exclusions->{-1, 1, 2.5, 11}]

0 commit comments

Comments
 (0)