-
-
Couldn't load subscription status.
- Fork 49k
Add tests without modifying code #10740
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
Changes from all commits
c414518
41fffa1
ff894a8
6aa37f2
16d377e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,32 @@ | ||
| def get_word_pattern(word: str) -> str: | ||
| """ | ||
| Returns numerical pattern of character appearances in given word | ||
| >>> get_word_pattern("") | ||
| '' | ||
| >>> get_word_pattern(" ") | ||
| '0' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please put the tests that work correctly first and then afterward the ones that raise exceptions. Also, please add: |
||
| >>> get_word_pattern("pattern") | ||
| '0.1.2.2.3.4.5' | ||
| >>> get_word_pattern("word pattern") | ||
| '0.1.2.3.4.5.6.7.7.8.2.9' | ||
| >>> get_word_pattern("get word pattern") | ||
| '0.1.2.3.4.5.6.7.3.8.9.2.2.1.6.10' | ||
| >>> get_word_pattern() | ||
| Traceback (most recent call last): | ||
| ... | ||
| TypeError: get_word_pattern() missing 1 required positional argument: 'word' | ||
| >>> get_word_pattern(1) | ||
| Traceback (most recent call last): | ||
| ... | ||
| AttributeError: 'int' object has no attribute 'upper' | ||
| >>> get_word_pattern(1.1) | ||
| Traceback (most recent call last): | ||
| ... | ||
| AttributeError: 'float' object has no attribute 'upper' | ||
| >>> get_word_pattern([]) | ||
| Traceback (most recent call last): | ||
| ... | ||
| AttributeError: 'list' object has no attribute 'upper' | ||
| """ | ||
| word = word.upper() | ||
| next_num = 0 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.