The tests named “rejects span longer than string length” and “rejects empty string and nonzero span” in the problem specifications use the error message “span must be smaller than string length”.
It conflicts with the first test, which is called “finds the largest product if span equals length”. Something like “span cannot be larger than string length” would be more accurate because span and string length can be equal.
I am not sure if it is going to be accepted because this issue has already been raised in a Python topic; however, I raise the discussion again because the problem specification is involved.
It would invalidate any solutions on tracks that check error messages from problem specs, but it is more accurate and in line with the other tests and instructions.
While the message being tested is now more precise, the student instructions need to be updated, too. I’ve just stumbled over this and have created an update in a forked repository. I’d be happy to open a PR for your review and possible acceptance.
The instruction currently says:
To raise a ValueError with a message, write the message as an argument to the exception type:
# span of numbers is longer than number series
raise ValueError("span must be smaller than string length")
It should be changed to:
# span of numbers is longer than number series
raise ValueError("span must not exceed string length")
I’d be happy to take a PR for changes to .docs/instructions.append.md for this exercise, if you have it. Just link the PR here. It will get auto-closed - but I can re-open and review it.
Many thanks!
If I don’t hear back by Monday Pacific Daylight Time (7/28), I’ll make a PR then.