def test_discover_no_test_files(self): py_files = ["main.py", "module.py"] self.create_files(self.prefix_with_package_name(py_files)) self.cheesecake.walk_pkg() self.cheesecake.compute_cheesecake_index() def get_list(type): return get_files_of_type(self.cheesecake.files_list, type) assert set(get_list("module")) == set(py_files) assert get_list("pyc") == [] assert get_list("pyo") == [] assert get_list("test") == []
def test_docstrings(self): objects_with_docstrings = [ "module1", "module1.Class1", "module1.Class2", "module1.Class3", "module1.Class1.__init__", "module1.Class1.__another_method__", "module1.Class1.method1", "module1.Class1.method2", "module1.Class1.method3", "module1.Class1.method5", "module1.func1", "module1.func2", "module1.func3", "module1.__func5__", "module1.func7", "module1.func8", "module1.outer_function.inner_function", ] objects_with_rest_docstrings = ["module1.Class1.method5", "module1.func7"] objects_with_epytext_docstrings = ["module1", "module1.Class3", "module1.func8"] objects_with_javadoc_docstrings = ["module1.Class1", "module1.func8"] # intentional overlap with epytext print(self.code1.docstrings) assert set(objects_with_docstrings) == set(self.code1.docstrings) assert set(objects_with_rest_docstrings) == set(self.code1.docstrings_by_format["reST"]) assert set(objects_with_epytext_docstrings) == set(self.code1.docstrings_by_format["epytext"]) assert set(objects_with_javadoc_docstrings) == set(self.code1.docstrings_by_format["javadoc"])
def test_some_pyc_and_pyo_files(self): py_files = ["main.py"] pyc_files = ["main.pyc", "missing.pyc"] pyo_files = ["main.pyo", "optimised.pyo"] self.create_files(self.prefix_with_package_name(py_files + pyc_files + pyo_files)) self.cheesecake.walk_pkg() self.cheesecake.compute_cheesecake_index() def get_list(type): return get_files_of_type(self.cheesecake.files_list, type) assert set(get_list("module")) == set(py_files) assert set(get_list("pyc")) == set(pyc_files) assert set(get_list("pyo")) == set(pyo_files) assert get_list("test") == []