mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[python] Tidy matplotlib tests
This commit is contained in:
committed by
LeaNumworks
parent
2738d30684
commit
d7804ad5d1
@@ -7,6 +7,10 @@ arrow(2,3,4,5)
|
||||
show()
|
||||
)";
|
||||
|
||||
QUIZ_CASE(python_matplotlib_pyplot_arrow) {
|
||||
assert_script_execution_succeeds(s_pyplotArrowScript);
|
||||
}
|
||||
|
||||
static const char * s_pyplotAxisScript = R"(#
|
||||
from matplotlib.pyplot import *
|
||||
axis((2,3,4,5))
|
||||
@@ -21,6 +25,11 @@ from matplotlib.pyplot import *
|
||||
axis(2,3,4,5)
|
||||
)";
|
||||
|
||||
QUIZ_CASE(python_matplotlib_pyplot_axis) {
|
||||
assert_script_execution_succeeds(s_pyplotAxisScript, "(2.0, 3.0, 4.0, 5.0)\n");
|
||||
assert_script_execution_fails(s_pyplotAxisErrorScript);
|
||||
}
|
||||
|
||||
static const char * s_pyplotBarScript = R"(#
|
||||
from matplotlib.pyplot import *
|
||||
bar([0,2,3],[10,12,23])
|
||||
@@ -37,6 +46,11 @@ bar([1,2,3],[1,2,3,4],[1,2,3],[1,2,3])
|
||||
show()
|
||||
)";
|
||||
|
||||
QUIZ_CASE(python_matplotlib_pyplot_bar) {
|
||||
assert_script_execution_succeeds(s_pyplotBarScript);
|
||||
assert_script_execution_fails(s_pyplotBarErrorScript);
|
||||
}
|
||||
|
||||
static const char * s_pyplotGridScript = R"(#
|
||||
from matplotlib.pyplot import *
|
||||
grid(True)
|
||||
@@ -44,6 +58,10 @@ grid()
|
||||
show()
|
||||
)";
|
||||
|
||||
QUIZ_CASE(python_matplotlib_pyplot_grid) {
|
||||
assert_script_execution_succeeds(s_pyplotGridScript);
|
||||
}
|
||||
|
||||
static const char * s_pyplotHistScript = R"(#
|
||||
from matplotlib.pyplot import *
|
||||
hist([2,3,4,5,6])
|
||||
@@ -53,6 +71,10 @@ hist([2,3,4,5,6],[0,2,3, 4,5,6,7])
|
||||
show()
|
||||
)";
|
||||
|
||||
QUIZ_CASE(python_matplotlib_pyplot_hist) {
|
||||
assert_script_execution_succeeds(s_pyplotHistScript);
|
||||
}
|
||||
|
||||
static const char * s_pyplotPlotScript = R"(#
|
||||
from matplotlib.pyplot import *
|
||||
plot([2,3,4,5,6])
|
||||
@@ -65,6 +87,11 @@ from matplotlib.pyplot import *
|
||||
plot([2,3,4,5,6],2)
|
||||
)";
|
||||
|
||||
QUIZ_CASE(python_matplotlib_pyplot_plot) {
|
||||
assert_script_execution_succeeds(s_pyplotPlotScript);
|
||||
assert_script_execution_fails(s_pyplotPlotErrorScript);
|
||||
}
|
||||
|
||||
static const char * s_pyplotScatterScript = R"(#
|
||||
from matplotlib.pyplot import *
|
||||
scatter(2,3)
|
||||
@@ -77,23 +104,17 @@ from matplotlib.pyplot import *
|
||||
scatter([2,3,4,5,6],2)
|
||||
)";
|
||||
|
||||
QUIZ_CASE(python_matplotlib_pyplot_scatter) {
|
||||
assert_script_execution_succeeds(s_pyplotScatterScript);
|
||||
assert_script_execution_fails(s_pyplotScatterErrorScript);
|
||||
}
|
||||
|
||||
static const char * s_pyplotTextScript = R"(#
|
||||
from matplotlib.pyplot import *
|
||||
text(2,3,'hello')
|
||||
show()
|
||||
)";
|
||||
|
||||
QUIZ_CASE(python_matplotlib_pyplot) {
|
||||
assert_script_execution_succeeds(s_pyplotArrowScript);
|
||||
assert_script_execution_succeeds(s_pyplotAxisScript, "(2.0, 3.0, 4.0, 5.0)\n");
|
||||
assert_script_execution_fails(s_pyplotAxisErrorScript);
|
||||
assert_script_execution_succeeds(s_pyplotBarScript);
|
||||
assert_script_execution_fails(s_pyplotBarErrorScript);
|
||||
assert_script_execution_succeeds(s_pyplotGridScript);
|
||||
assert_script_execution_succeeds(s_pyplotHistScript);
|
||||
assert_script_execution_succeeds(s_pyplotPlotScript);
|
||||
assert_script_execution_fails(s_pyplotPlotErrorScript);
|
||||
assert_script_execution_succeeds(s_pyplotScatterScript);
|
||||
assert_script_execution_fails(s_pyplotScatterErrorScript);
|
||||
QUIZ_CASE(python_matplotlib_pyplot_text) {
|
||||
assert_script_execution_succeeds(s_pyplotTextScript);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user