You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just saw a solution to the word_count exercise where my feeling was that this shouldn't pass all tests. There is already one mixed case test, but it has a specific word order so that this solution works.
It was justified because other language tracks expect normalization - specifically ruby and clojure in the pull request. I also noticed Haskell does this normalization.
The problem is not that normalization is tested. The problem is also not that the test is not opinionated about how to normalize case.
The problem is that the test is so minimalistic that a user wrote code that passed the test suite while the solution only works if the function gets the words in the right order.
My simple solution to the mixed case test is to expand the test string "go Go GO" to "go Go GO Stop stop" and assume as result a dict with the values 3, 2. That would still not force the user to only normalize to lower case.
deftest_mixed_case(self):
self.assertEqual([2, 3], sorted(list(word_count('go Go GO Stop stop').values())))
I actually don't mind which direction the user normalizes to, and I think that it would be nice to leave that up to the person solving the problem. I like this suggested approach and wouldn't mind changing the other tracks to use it.
Activity
Dog commentedon Nov 10, 2015
The reason for this is that a change was applied to the test to normalize case.
0314cbf
#207
It was justified because other language tracks expect normalization - specifically ruby and clojure in the pull request. I also noticed Haskell does this normalization.
behrtam commentedon Nov 10, 2015
The problem is not that normalization is tested. The problem is also not that the test is not opinionated about how to normalize case.
The problem is that the test is so minimalistic that a user wrote code that passed the test suite while the solution only works if the function gets the words in the right order.
My simple solution to the mixed case test is to expand the test string
"go Go GO"to"go Go GO Stop stop"and assume as result a dict with the values 3, 2. That would still not force the user to only normalize to lower case.kytrinyx commentedon Nov 12, 2015
I actually don't mind which direction the user normalizes to, and I think that it would be nice to leave that up to the person solving the problem. I like this suggested approach and wouldn't mind changing the other tracks to use it.
behrtam commentedon Nov 12, 2015
Okay, did it for the Python track.
word-count: tweak normalization test case
word-count: tweak normalization test case