Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change anagram test case input #2314

Merged
merged 1 commit into from Sep 22, 2023
Merged

Conversation

olapokon
Copy link
Contributor

@olapokon olapokon commented Sep 4, 2023

The input for the anagram function is supposed to be a list containing single word strings, as in all other test cases. This test case has multiple words in the same string, separated by whitespace.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 4, 2023

Hello. Thanks for opening a PR on Exercism. We are currently in a phase of our journey where we have paused community contributions to allow us to take a breather and redesign our community model. You can learn more in this blog post. As such, all issues and PRs in this repository are being automatically closed.

That doesn't mean we're not interested in your ideas, or that if you're stuck on something we don't want to help. The best place to discuss things is with our community on the Exercism Community Forum. You can use this link to copy this into a new topic there.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

@github-actions github-actions bot closed this Sep 4, 2023
@ErikSchierboom ErikSchierboom reopened this Sep 4, 2023
Copy link
Member

@ErikSchierboom ErikSchierboom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes the test input to no long match the description, which states that the word is repeated. The new input does not test that, it "merely" checks for case insensitivity, which we already have tests for.

@olapokon
Copy link
Contributor Author

olapokon commented Sep 5, 2023

It's true that this change would make this test equivalent to the "words are not anagrams of themselves (case-insensitive)" test. Keeping it as a single string but removing the spaces is another option (the nearest, but not exact, equivalent to this probably is the test case "anagrams must use all letters exactly once").

It could remain as is, but it is a bit weird that this is the only candidate string that has spaces in it, thus making it necessary to account for whitespace in the solution, which doesn't seem to be intended.

@ErikSchierboom
Copy link
Member

It could remain as is, but it is a bit weird that this is the only candidate string that has spaces in it, thus making it necessary to account for whitespace in the solution, which doesn't seem to be intended.

I 100% agree with that. Ideally it should be deprecated, but I don't think we yet have a deprecation option. Not sure what the best option would be

@olapokon
Copy link
Contributor Author

olapokon commented Sep 5, 2023

Changing it from "go Go GO" to "goGoGO" would not make the description invalid and there would be no whitespace. But this PR can be closed without making any changes, if you'd prefer to wait until it is possible to deprecate it.

@ErikSchierboom
Copy link
Member

Changing it from "go Go GO" to "goGoGO" would not make the description invalid and there would be no whitespace

That would be perfectly fine with me

@olapokon
Copy link
Contributor Author

olapokon commented Sep 5, 2023

I changed it to a single string without whitespace.

@ErikSchierboom
Copy link
Member

The final thing left to do is to, instead of mutating the existing test, you create a new test with a reimplements field that contains the UUID of the old test.

@olapokon
Copy link
Contributor Author

olapokon commented Sep 5, 2023

I just generated a UUID for the new test and pasted it, apparently it should adhere to this pattern '^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$ Should I just modify it myself or is there some particular way these are generated?

@MatthijsBlom
Copy link
Contributor

configlet uuid can generate these.

@olapokon
Copy link
Contributor Author

olapokon commented Sep 5, 2023

Thanks, I used configlet for the UUID.

"candidates": ["goGoGO"]
},
"expected": []
},
{
"uuid": "9878a1c9-d6ea-4235-ae51-3ea2befd6842",
"description": "anagrams must use all letters exactly once",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we state "all letters of the source word" or something similar?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that a different test case? I mean, I don't disagree, but it looks like a different test case?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean that the description, then, is not right in general?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so

Copy link
Contributor Author

@olapokon olapokon Sep 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kotp Did you mean change "anagrams must use all letters exactly once" to "anagrams must use all letters of the source word exactly once"? As @ErikSchierboom says this is the testcase below. Or did you mean change "does not detect an anagram if the original word is repeated" to "does not detect an anagram if all letters of the source word are repeated"?

If you meant the former, is the description ok as it is now? It currently is "does not detect an anagram if the original word is repeated", which seems to fit the test case even after removing the spaces, since it is the original word being repeated, just without spaces in-between.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your change is fine on lines 135-145, so we are really talking about what you have not changed, and may change, as suggested.

Additionally, if you choose not to fix it while we are here, that is OK too. It may be changed at another time, in another pull request.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I must say that your change may be redundant if the following test case is described better. It is not described well at the moment. It may be enforcing the same thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on how one looks at it I guess. The original reason for this change was that the existing test is problematic due to the whitespace. I can change the next test's description as suggested if you prefer, or close the pull request and leave the goGoGO test as it is until it can be deprecated/removed completely.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge this as is and do the update of the other test case in a separate PR.

@ErikSchierboom ErikSchierboom merged commit 42e5989 into exercism:main Sep 22, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants