Remove redundant functions

This commit is contained in:
hugovk 2017-09-26 09:14:24 +03:00
parent ec68660014
commit 0eac6e9ae2
2 changed files with 0 additions and 40 deletions

View file

@ -2873,37 +2873,6 @@ def _extract(node, name, index=0):
return None return None
def _extract_element_tree(node):
"""Extract an element tree into a multi-level dictionary
NB: If any elements have text nodes as well as nested
elements this will ignore the text nodes"""
def _recurse_build_tree(rootNode, targetDict):
"""Recursively build a multi-level dict"""
def _has_child_elements(rootNode):
"""Check if an element has any nested (child) elements"""
for node in rootNode.childNodes:
if node.nodeType == node.ELEMENT_NODE:
return True
return False
for node in rootNode.childNodes:
if node.nodeType == node.ELEMENT_NODE:
if _has_child_elements(node):
targetDict[node.tagName] = {}
_recurse_build_tree(node, targetDict[node.tagName])
else:
val = None if node.firstChild is None else \
_unescape_htmlentity(node.firstChild.data.strip())
targetDict[node.tagName] = val
return targetDict
return _recurse_build_tree(node, {})
def _extract_all(node, name, limit_count=None): def _extract_all(node, name, limit_count=None):
"""Extracts all the values from the xml string. returning a list.""" """Extracts all the values from the xml string. returning a list."""

View file

@ -624,15 +624,6 @@ class TestPyLast(unittest.TestCase):
self.assertIsInstance(thing2.item, expected_type) self.assertIsInstance(thing2.item, expected_type)
self.assertNotEqual(thing1, thing2) self.assertNotEqual(thing1, thing2)
def helper_two_things_in_list(self, things, expected_type):
# Assert
self.assertEqual(len(things), 2)
self.assertIsInstance(things, list)
thing1 = things[0]
thing2 = things[1]
self.assertIsInstance(thing1, expected_type)
self.assertIsInstance(thing2, expected_type)
def test_user_get_top_tags_with_limit(self): def test_user_get_top_tags_with_limit(self):
# Arrange # Arrange
user = self.network.get_user("RJ") user = self.network.get_user("RJ")