def test_class(): node = Node.factory('cli2.test_node.ExampleClass') assert node.target == ExampleClass assert Node('', ExampleClass.example_method) in node.callables
def test_unknown(): node = Node.factory('lollololololololollolool') assert not node.module assert not node.target
def test_function(): node = Node.factory('cli2.test_node.example_function') assert node.target == example_function assert node.type == 'function' assert not node.callables
def test_dict(): node = Node.factory('cli2.test_node.example_dict.a') assert node.target == example_dict['a']
def test_list(): node = Node.factory('cli2.test_node.example_list.0') assert node.target == example_list[0]
def test_eq(): assert Node.factory('cli2') == Node.factory('cli2')
def test_callable_object(): node = Node.factory('cli2.test_node.example_object_callable') assert node.target == example_object_callable
def test_callable_class(): node = Node.factory('cli2.test_node.ExampleClassCallable') assert node.target == ExampleClassCallable