@@ -48,9 +48,6 @@ def function_plotter(app_instance, qtbot):
48
48
49
49
50
50
def test_basic_function_input (function_plotter , qtbot ):
51
- """
52
- Test plotting a basic function.
53
- """
54
51
function_plotter .function_input .setText ("5*x^3 + 2*x" )
55
52
function_plotter .min_input .setText ("0" )
56
53
function_plotter .max_input .setText ("10" )
@@ -70,9 +67,6 @@ def test_invalid_character_in_function(function_plotter, qtbot):
70
67
71
68
72
69
def test_complex_formula_function (function_plotter , qtbot ):
73
- """
74
- Test plotting a complex formula function.
75
- """
76
70
function_plotter .function_input .setText ("5*x^3 + 2*x - 4/x + 7" )
77
71
function_plotter .min_input .setText ("-10" )
78
72
function_plotter .max_input .setText ("10" )
@@ -81,9 +75,6 @@ def test_complex_formula_function(function_plotter, qtbot):
81
75
82
76
83
77
def test_using_sqrt_and_log10_in_function (function_plotter , qtbot ):
84
- """
85
- Test plotting a function using sqrt and log10.
86
- """
87
78
function_plotter .function_input .setText ("2*x^4 - log10(x) + sqrt(x)" )
88
79
function_plotter .min_input .setText ("0" )
89
80
function_plotter .max_input .setText ("50" )
@@ -114,9 +105,6 @@ def test_wrong_input_for_min_and_max_values(function_plotter, qtbot):
114
105
115
106
116
107
def test_using_infinity_for_min_and_max_values (function_plotter , qtbot ):
117
- """
118
- Test plotting a function with -inf and +inf for min and max values.
119
- """
120
108
function_plotter .function_input .setText ("x" )
121
109
function_plotter .min_input .setText ("-inf" )
122
110
function_plotter .max_input .setText ("inf" )
@@ -125,11 +113,41 @@ def test_using_infinity_for_min_and_max_values(function_plotter, qtbot):
125
113
126
114
127
115
def test_constant_function_formula (function_plotter , qtbot ):
128
- """
129
- Test plotting a constant function.
130
- """
131
116
function_plotter .function_input .setText ("5" )
132
117
function_plotter .min_input .setText ("-10" )
133
118
function_plotter .max_input .setText ("10" )
134
119
qtbot .mouseClick (function_plotter .plot_button , Qt .LeftButton )
135
- assert function_plotter .ax .has_data ()
120
+ assert function_plotter .ax .has_data ()
121
+
122
+
123
+ def test_empty_function (function_plotter , qtbot ):
124
+ with qtbot .wait_signal (
125
+ function_plotter .error_message_signal , timeout = 5000
126
+ ) as blocker :
127
+ function_plotter .function_input .setText ("" )
128
+ function_plotter .min_input .setText ("" )
129
+ function_plotter .max_input .setText ("" )
130
+ qtbot .mouseClick (function_plotter .plot_button , Qt .LeftButton )
131
+ assert blocker .args [0 ] == "Function cannot be empty."
132
+
133
+
134
+ def test_min_greater_than_max (function_plotter , qtbot ):
135
+ with qtbot .wait_signal (
136
+ function_plotter .error_message_signal , timeout = 5000
137
+ ) as blocker :
138
+ function_plotter .function_input .setText ("x" )
139
+ function_plotter .min_input .setText ("10" )
140
+ function_plotter .max_input .setText ("5" )
141
+ qtbot .mouseClick (function_plotter .plot_button , Qt .LeftButton )
142
+ assert blocker .args [0 ] == "Min value must be less than Max value."
143
+
144
+
145
+ def test_empty_range_values (function_plotter , qtbot ):
146
+ with qtbot .wait_signal (
147
+ function_plotter .error_message_signal , timeout = 5000
148
+ ) as blocker :
149
+ function_plotter .function_input .setText ("x" )
150
+ function_plotter .min_input .setText ("" )
151
+ function_plotter .max_input .setText ("5" )
152
+ qtbot .mouseClick (function_plotter .plot_button , Qt .LeftButton )
153
+ assert blocker .args [0 ] == "Min and Max values cannot be empty."
0 commit comments