def test_not_node_2(self): node = 'something-else' self.assertEqual(soft_get(node, 'string'), '<SUB-ELEMENT>')
def test_not_callable(self): node = MagicMock() node.soft_get = 'foo' self.assertEqual(soft_get(node, 'string'), '<SUB-ELEMENT>')
def test_not_node_1(self): node = {'soft_get': lambda attr: attr} self.assertEqual(soft_get(node, 'string'), '<SUB-ELEMENT>')
def test_node(self): node = MagicMock() node.soft_get = lambda attr: attr self.assertEqual(soft_get(node, 'string'), 'string')