Skip to content

Commit

Permalink
Merge pull request #6667 from csabella/issue6664
Browse files Browse the repository at this point in the history
PR: Fix typo in utils.introspection.get_words
  • Loading branch information
ccordoba12 authored Mar 8, 2018
2 parents 53ae83e + 8225a8e commit 3f3dea1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion spyder/utils/introspection/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def get_words(file_path=None, content=None, extension=None):

if extension in ['.css']:
regex = re.compile(r'([^a-zA-Z-])')
elif extension in ['.R', '.c', 'md', '.cpp, java', '.py']:
elif extension in ['.R', '.c', '.md', '.cpp', '.java', '.py']:
regex = re.compile(r'([^a-zA-Z_])')
else:
regex = re.compile(r'([^a-zA-Z])')
Expand Down
1 change: 1 addition & 0 deletions spyder/utils/tests/data/example.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class HelloWorld {

public static void main(String[] args) {
// Prints "Hello, World" to the terminal window.
// test_underscore
System.out.println("Hello, World");
}

Expand Down
2 changes: 2 additions & 0 deletions spyder/utils/tests/data/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ A paragraph after 1 blank line.
print '3 backticks or'
print 'indent 4 spaces'
```

under_score
9 changes: 5 additions & 4 deletions spyder/utils/tests/test_get_words.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,21 @@ def test_get_words_java():
"""Test for get word from java file syntax."""
expected_words = ['Compilation', 'Execution', 'Hello', 'HelloWorld', 'Prints', 'String',
'System', 'World', 'args', 'class', 'java', 'javac', 'main', 'out',
'println', 'public', 'static', 'terminal', 'the', 'to', 'void', 'window']
'println', 'public', 'static', 'terminal', 'test_underscore',
'the', 'to', 'void', 'window']
assert sorted(expected_words) == sorted(get_words_by_filename("example.java"))
assert sorted(expected_words) == sorted(get_words_by_content("example.java"))

def test_get_words_cplusplus():
"""Test for get word from C++ file syntax."""
expected_words = ['Consider', 'Create', 'Implement', 'Obj', 'ObjContainer',
'Postfix', 'Prefix', 'Return', 'SmartPointer', 'Static',
'Zero', 'a', 'above', 'access', 'actual', 'add', 'an', 'back',
'Zero', 'a', 'above', 'access', 'actual', 'add', 'an',
'bool', 'call', 'class', 'const', 'container', 'cout', 'definitions',
'do', 'end', 'endl', 'f', 'false', 'for', 'friend', 'g', 'i', 'if',
'implement', 'include', 'index', 'indicates', 'int', 'iostream', 'iterator',
'j', 'list', 'main', 'member', 'method', 'namespace', 'o', 'obj', 'objc',
'oc', 'of', 'operator', 'overload', 'pointer', 'public', 'push', 'return',
'oc', 'of', 'operator', 'overload', 'pointer', 'public', 'push_back', 'return',
's', 'size', 'smart', 'sp', 'standard', 'static', 'std', 'sz', 'the',
'to', 'true', 'using', 'value', 'vector', 'version', 'void', 'while']
assert sorted(expected_words) == sorted(get_words_by_filename("example.cpp"))
Expand All @@ -93,7 +94,7 @@ def test_get_words_markdown():
'Italic', 'Link', 'List', 'One', 'Rule', 'Three', 'Two', 'a', 'after',
'b', 'backticks', 'blank', 'block', 'code', 'com', 'http', 'indent',
'jpg', 'line', 'or', 'org', 'paragraph', 'png', 'print', 'spaces',
'url', 'with']
'under_score', 'url', 'with']
assert sorted(expected_words) == sorted(get_words_by_filename("example.md"))
assert sorted(expected_words) == sorted(get_words_by_content("example.md"))

Expand Down

0 comments on commit 3f3dea1

Please sign in to comment.