def test_different_number_of_parameters(): f(5) f(<warning descr="Expected type 'int', got 'str' instead">"a"</warning>) f(5, "a") f(<warning descr="Expected type 'int', got 'str' instead">"a"</warning>, "b") f(5, <warning descr="Expected type 'str', got 'int' instead">6</warning>) f(<warning descr="Expected type 'int', got 'str' instead">"a"</warning>, <warning descr="Expected type 'str', got 'int' instead">5</warning>)
def plot(result, dx=False, ig=False): l = Label(master=window, text=("" if dx == False else "Derivative of ") + ("" if ig == False else "Integral of ") + result) l.config(font=("Courier", 10)) l.pack() window.update() # the figure that will contain the plot fig = Figure(figsize=(7, 7), dpi=300) x = np.arange(0, 3, 0.001) # list of squares result = m1.format_space(result) print("f", result) result = m1.words2symbol(result) print("w2s", result) y = m1.f(result) print(y) # adding the subplot plot1 = fig.add_subplot(111) # plotting the graph if dx == False and ig == False: plot1.plot(x, y) elif dx: plot1.plot(x[1:], np.diff(y) / np.diff(x)) elif ig: result1 = result.replace('x', 'q') print(result1) exp = sympy.sympify(result1) iexp = sympy.integrate(exp, q) print(iexp) for i in range(len(x)): y[i] = iexp.subs(q, x[i]).evalf() print(y[i]) plot1.plot(x, y) # creating the Tkinter canvas # containing the Matplotlib figure canvas = FigureCanvasTkAgg(fig, master=window) canvas.draw() # placing the canvas on the Tkinter window canvas.get_tk_widget().pack() # creating the Matplotlib toolbar toolbar = NavigationToolbar2Tk(canvas, window) toolbar.update() # placing the toolbar on the Tkinter window canvas.get_tk_widget().pack()
def test_overloaded_function(x): g(<warning descr="Expected type 'dict', got 'int' instead">f(10)</warning>) g(<warning descr="Expected type 'dict', got 'str' instead">f('foo')</warning>) g(<warning descr="Expected type 'dict', got 'Union[int, str]' instead">f(<warning descr="Expected type 'int', got 'Dict[int, int]' instead">{1: 2}</warning>)</warning>) g(<warning descr="Expected type 'dict', got 'Union[int, str]' instead">f(x)</warning>)
def test_overloaded_function(x): g(<warning descr="Expected type 'dict', got 'int' instead">f(10)</warning>) g(<warning descr="Expected type 'dict', got 'str' instead">f('foo')</warning>) g(<warning descr="Expected type 'dict', got 'Union[str, int]' instead">f(<warning descr="Unexpected type(s):(dict[int, int])Possible type(s):(str)(int)">{1: 2}</warning>)</warning>) g(<warning descr="Expected type 'dict', got 'Union[str, int]' instead">f(x)</warning>)
def g(): global a a = m1.f(3) + 1 return m1.h()
def test_overloaded_function(x): g(<warning descr="Expected type 'dict', got 'int' instead">f(10)</warning>) g(<warning descr="Expected type 'dict', got 'str' instead">f('foo')</warning>) g(<warning descr="Expected type 'dict', got 'Union[int, str]' instead">f(<warning descr="Unexpected type(s):(Dict[int, int])Possible types:(str)(int)">{1: 2}</warning>)</warning>) g(<warning descr="Expected type 'dict', got 'Union[int, str]' instead">f(x)</warning>)
def g(x): return m1.f(100)