A strange case of testing two edits

Hi friends,
I implemented the allow_swithches option in edit_one_letter.
It seems my code does not pass the correct value of Allow_switches( False) when the word is at. so the test execute as Allow=True and get the larger value than expected.
The odd thing the same test pass in for the word cat. The code get the correct value for allow_switches when False and when True.

word= a ,allow= true, test pass
word= at, allow= true, test pass
word= at, allow= true, test fails since the code did not take the correct value: Allow( False)
Wrong output type.
Expected: 7130.
Got: 7154.
word= cat, allow =false, test pass.
word =cat, allow= true, test pass.
19 Tests passed
1 Tests failed

all test scenarios before and after this test pass including get corrections.
any insight, advice.

I also tested the two_edits with the word at and allow_switche flase. and the code work correctly.
the issue seems with pass the value of allow_switches during test.

I have not taken that course and have no idea about the problems that you are talking about. But there is one thing to be very careful about, which is how the Jupyter notebooks work. Just typing new code in a function cell and then calling the function again does nothing: it just runs the old code. You actually have to click “Shift-Enter” on the modified cell before the new code will be loaded into the runtime image.

You can easily demonstrate this to yourself:

  1. Start with a function which is known to work and pass its unit test. Run the test and it passes.
  2. Now break the function in an obvious way, e.g. multiply the output value by 2, but don’t click “Shift-Enter” on the function cell.
  3. Now call the function from the test cell and it still works.
  4. Now click “Shift-Enter” on the function cell to interpret the new broken code.
  5. Now run the test again and “Kaboom!” it fails.

So the overall point is that you have to be very careful to pay attention to the state of the notebook when you are running experiments like this. Anytime you want to make sure things are in a consistent state, do “Kernel → Restart and Clear Output” followed by “Cell → Run All”.

I do restart and clear out then Cell run all. every time I modify test. Unfortunately not the issue