Testing a function in python without in- and output value

23 Views Asked by At

I have the following function in my py-file.

def change_grid():
    print("switch grid, current value:", grid_var.get())
    global grid
    if grid_var.get() == "off":
        grid = False
    else:
        grid = True

How can I test this function with unittest, as it has no return value?

I searched and found that I can mock the grid_var.get() function so it returns "off" in the test. But how can I check if the global variable grid is set to false or true in the test?

0

There are 0 best solutions below