Skip to content
Snippets Groups Projects
Commit 782ada18 authored by Pierre Penninckx's avatar Pierre Penninckx Committed by GitHub
Browse files

Merge pull request #125 from PyCQA/fix_append_call_break_help

Fix append call breaks help
parents ded6209d bf754af4
No related branches found
No related tags found
No related merge requests found
Changelog
=========
 
0.6.3 (unreleased)
-----------------
- fix help() after append
0.6.2 (2016-10-03)
----------------
 
Loading
Loading
Loading
Loading
@@ -632,7 +632,10 @@ class Node(GenericNodesUtils):
if self.on_attribute is "root":
in_list = self.parent
elif self.on_attribute is not None:
in_list = getattr(self.parent, self.on_attribute)
if isinstance(self.parent, NodeList):
in_list = getattr(self.parent.parent, self.on_attribute)
else:
in_list = getattr(self.parent, self.on_attribute)
else:
return None
 
Loading
Loading
@@ -865,35 +868,35 @@ class Node(GenericNodesUtils):
def _get_helpers(self):
not_helpers = set([
'copy',
'decrease_indentation',
'dumps',
'edit',
'find',
'findAll',
'find_all',
'fst',
'help',
'next_generator',
'previous_generator',
'get_indentation_node',
'indentation_node_is_direct',
'parent_find',
'path',
'findAll',
'find_by_path',
'replace',
'edit',
'increase_indentation',
'decrease_indentation',
'has_render_key',
'get_absolute_bounding_box_of_attribute',
'find_by_position',
'parse_code_block',
'parse_decorators',
'from_fst',
'fst',
'generate_identifiers',
'get_absolute_bounding_box_of_attribute',
'get_indentation_node',
'has_render_key',
'help',
'increase_indentation',
'indentation_node_is_direct',
'index_on_parent',
'index_on_parent_raw',
'insert_before',
'insert_after',
'insert_before',
'next_generator',
'parent_find',
'parse_code_block',
'parse_decorators',
'path',
'previous_generator',
'replace',
'to_python',
'generate_identifiers',
])
return [x for x in dir(self) if
not x.startswith("_") and x not in not_helpers and inspect.ismethod(getattr(self, x))]
Loading
Loading
Loading
Loading
@@ -99,11 +99,49 @@ def test_get_helpers():
assert red[0]._get_helpers() == ['modules', 'names']
 
 
def test_help_is_not_crashing():
def test_help_is_not_crashing1():
some_code = "ax + (z * 4)"
red = RedBaron(some_code)
red.help()
red[0].help()
red.help(5)
red[0].help(5)
red.help(True)
red[0].help(True)
def test_help_is_not_crashing2():
some_code = "a(b)"
red = RedBaron(some_code)
red.help()
red[0].help()
red.help(5)
red[0].help(5)
red.help(True)
red[0].help(True)
def test_help_is_not_crashing3():
some_code = "a(b, c)"
red = RedBaron(some_code)
red.help()
red[0].help()
red.help(5)
red[0].help(5)
red.help(True)
red[0].help(True)
def test_help_is_not_crashing4():
some_code = "a(b)"
red = RedBaron(some_code)
red[0].call.append("c")
red.help()
red[0].help()
red.help(5)
red[0].help(5)
red.help(True)
red[0].help(True)
 
 
def test_assign_on_string_value():
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment