working with pytest we now have four tests to run (we could go further but this is enough for nowone of the issues with this set of tests is that we have repeated the creation of the calculator object at the start of each test while this is not problem in itself it does result in duplicated code and the possibility of future issues in terms of maintenance if we want to change the way calculator is created it may also not be as efficient as reusing the calculator object for each test we can howeverdefine fixture that can be run before each individual test function is executed to do this we will write new function and use the pytest fixture decorator on that function this marks the function as being special and that it can be used as fixture on an individual function functions that require the fixture should accept reference to the fixture as an argument to the individual test function for examplefor test to accept fixture called calculatorit should have an argument with the fixture namei calculator this name can then be used to access the object returned this is illustrated belowimport pytest from calculator import calculator @pytest fixture def calculator()"""returns calculator instance""return calculator(def test_initial_value(calculator)assert calculator total = def test_add_one(calculator)calculator set( calculator add(assert calculator total = def test_subtract_one(calculator)calculator set( calculator sub(assert calculator total =- def test_add_one_and_one(calculator)calculator set( calculator add(calculator set( calculator add(assert calculator total =