Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

Commit

Permalink
gio file monitor does not need in file exist
Browse files Browse the repository at this point in the history
  • Loading branch information
baverman committed Oct 20, 2010
1 parent 240fde5 commit f6a1ee3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
6 changes: 1 addition & 5 deletions snaked/plugins/python/ropehints.py
Expand Up @@ -130,8 +130,4 @@ def load_hints(self):
scope, name, type = l.strip().split()
self.add_hint(scope, name, type)
except ValueError:
continue
else:
with open(self.hints_filename) as f:
f.write('')

continue
29 changes: 26 additions & 3 deletions tests/test_ropehints.py
Expand Up @@ -22,15 +22,26 @@ def func_with_unknown_return(magick_arg):
def caller_of_func_with_unknown_return(lol):
return func_with_unknown_return(lol).s

def caller_of_module_attribute():
import re
re.compile.s

class Lolwhat(object):
def star(self):
pass

def superstar(self):
pass

def get_project():
if os.path.exists('/tmp/.ropeproject'):
import shutil
shutil.rmtree('/tmp/.ropeproject')

return Project('/tmp')

def test_func_param_hint():
project = Project('/tmp')
project = get_project()
hintdb = ReHintDb(project)
hintdb.add_hint('.*', 'lolwhat', 'test_ropehints.Lolwhat')
module_path = os.path.join(os.path.dirname(__file__), __name__+'.py')
Expand All @@ -41,12 +52,24 @@ def test_func_param_hint():
assert ['superstar', 'star'] == [p.name for p in proposals]

def test_func_return():
project = Project('/tmp')
project = get_project()
hintdb = ReHintDb(project)
hintdb.add_hint('test_ropehints.func_with_unknown_return', '^return$', 'test_ropehints.Lolwhat')
module_path = os.path.join(os.path.dirname(__file__), __name__+'.py')
source = open(module_path).read().decode('utf8')
resource = get_rope_resource(project, module_path)

proposals = code_assist(project, source, 573, resource=resource)
assert ['superstar', 'star'] == [p.name for p in proposals]
assert ['superstar', 'star'] == [p.name for p in proposals]

def test_module_attribute():
project = get_project()
hintdb = ReHintDb(project)
hintdb.add_hint('re', '^compile$', 'test_ropehints.Lolwhat')
module_path = os.path.join(os.path.dirname(__file__), __name__+'.py')
source = open(module_path).read().decode('utf8')
resource = get_rope_resource(project, module_path)

proposals = code_assist(project, source, 639, resource=resource)
assert ['superstar', 'star'] == [p.name for p in proposals]

0 comments on commit f6a1ee3

Please sign in to comment.