From 1caf4990e4c8f522407fe2570d7cb2179b3fc66f Mon Sep 17 00:00:00 2001 From: sobolevn Date: Mon, 24 Sep 2018 10:11:18 +0300 Subject: [PATCH] Improves docs and tests --- README.md | 26 ++++++++++++++++++++++++++ tests/fixtures/incorrect.py | 19 +++++++++++++++++++ tests/test_comments.py | 4 ++++ 3 files changed, 49 insertions(+) diff --git a/README.md b/README.md index adff2b5..87d17ba 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,32 @@ So, we ignore `--aggressive` option from `eradicate`. |:----------:|:------------------------:| | E800 | Found commented out code | +## Output example + +```terminal +ยป flake8 tests/fixtures/incorrect.py +tests/fixtures/incorrect.py:1:1: E800: Found commented out code: +--- before/tests/fixtures/incorrect.py ++++ after/tests/fixtures/incorrect.py +@@ -1,16 +1,10 @@ + + class Some(object): +- # property_name = 1 + other_property = 2 + + +-# def function_name(): +-# return None + + +-# class CommentedClass(object): + # def __init__(self) -> None: +-# self.property = None + + # def __str__(self) -> str: +-# return self.__class__.__name__ +``` + ## License MIT. diff --git a/tests/fixtures/incorrect.py b/tests/fixtures/incorrect.py index efe735c..77a3c12 100644 --- a/tests/fixtures/incorrect.py +++ b/tests/fixtures/incorrect.py @@ -1,4 +1,23 @@ class Some(object): # property_name = 1 + # typed_property: int = 10 other_property = 2 + + +# def function_name(): +# return None + + +# class CommentedClass(object): +# def __init__(self, prop: int) -> None: +# self.property = prop + +# def __str__(self) -> str: +# return self.__class__.__name__ + +# def set_prop(self, prop: int): +# self.prop = prop + +# def get_prop(self): +# return self.prop diff --git a/tests/test_comments.py b/tests/test_comments.py index d95b9fe..dba6d75 100644 --- a/tests/test_comments.py +++ b/tests/test_comments.py @@ -27,3 +27,7 @@ def test_incorrect_fixture(absolute_path): stdout, _ = process.communicate() assert stdout.count(b'E800') == 1 + assert b'- # property_name = 1' in stdout + assert b'- # typed_property: int = 10' in stdout + assert b'-# def function_name():' in stdout + assert b'-# class CommentedClass(object):' in stdout