def test_node_is_instance_inheritance(): module = astroid.parse(test_doc_other_str) cls = module.body[3] node = list(cls.body[0].get_children())[-1] r = utils.node_is_instance(next(node.infer()), 'mongoengine.fields.StringField') assert r is True
def test_node_isinstance_bad_node(): module = astroid.parse(test_funcdef) funcdef = module.body[0] r = utils.node_is_instance(funcdef, 'mongomotor.Document') assert r is False