def validate(self, filename, module, classname, ignore):
with open(os.path.normpath(os.path.join('<STR_LIT>', '<STR_LIT>', filename))) as f:<EOL><INDENT>docs = f.read()<EOL><DEDENT>module = module_loading.import_module(module)<EOL>methods = re.findall(r'<STR_LIT>', docs, flags=re.M)<EOL>attributes = re.findall(r'<STR_LIT>', docs, flags=re.M)<EOL>documented = set(filter(lambda x: x.startswith(classname), [a for a in methods] + attributes))<EOL>implemented = set(classname + '<STR_LIT:.>' + x for x in dir(getattr(module, classname))<EOL>if not x.startswith('<STR_LIT:_>') or x == '<STR_LIT>')<EOL>print(implemented)<EOL>ignored = set(classname + '<STR_LIT:.>' + x for x in ignore)<EOL>self.assertSetEqual(implemented - documented - ignored, set(), msg='<STR_LIT>')<EOL>self.assertSetEqual(documented - implemented - ignored, set(), msg='<STR_LIT>')<EOL>
Finds all automethod and autoattribute statements in an rst file
comparing them to the attributes found in the actual class