Bob: Request to add test case for shouting statement with question mark not at end

The previous test cases would consider any shouting statement with a question mark to be a shouting question. This is not the case as a question must end with a question mark. This test case covers this scenario.

Opened PR #2661 and was directed here so hope you can help!

Which test?

Do you mean something like this?

1 Like

Thanks for getting back IsaacG, this would work given the user is not ā€œshoutingā€ (all caps) in this case.

Given the test case I gave of DO LIONS EAT PEOPLE? AHHHHH.
The sentence does not end with a question mark but is still shouting. Therefore should output Whoa, chill out! because it is not a question.
But given the current test cases there is no way to ensure that will happen when all CAPS. This is some example code I mentored earlier where I noticed this passing.

...
    if "?" in hey_bob and hey_bob.isupper():
        return "Calm down, I know what I'm doing!"
    if hey_bob.isupper():
        return "Whoa, chill out!"
...

This should fail as it would respond with Calm down, I know what I'm doing!. In reality this code passed all current test cases, my proposed test case should prevent this.

Thanks
Jack

1 Like

I’m in favour. I’ve seen people doing different regexes for each condition, and this is capturing an edge case.

2 Likes

Also in favor.

2 Likes

I’m also in favor. That’s the usual three maintainers approving that we like to do before an problem-specs PR is welcomed. I think we can reopen the PR if there aren’t any objections.

1 Like

PR reopened. Thanks!

Next time please do discuss it on the forum first, though ;)

2 Likes

PR merged. I opened a follow up to sort the test cases.

1 Like