This is mostly caused by your hard-coding for variables, parameters and so on.
This test is actually sets the iteration count to 50, then, call model(). So, expected output for “cost” is just one length. But, if you hardcode parameters for num_iterations=2000, then, you will get 20 costs values. That’s the reason of an assertion error.