summaryrefslogtreecommitdiff
path: root/flake8
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-06-07 10:14:45 -0500
committerIan Cordasco <graffatcolmingov@gmail.com>2016-06-07 10:14:45 -0500
commit9ebaa5c69c7dc7077d1f59141a863d22e23284c0 (patch)
tree3fe590afc819143827298f7db579af426e686772 /flake8
parent02bcbee245b9b5a0c75345ada0f1d7e70d19b3c0 (diff)
downloadflake8-9ebaa5c69c7dc7077d1f59141a863d22e23284c0.tar.gz
Add tests for parse_unified_diff
We could probably use non-git diff fixtures, but those are what we have for now.
Diffstat (limited to 'flake8')
-rw-r--r--flake8/utils.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/flake8/utils.py b/flake8/utils.py
index f6ce384..7cd12b0 100644
--- a/flake8/utils.py
+++ b/flake8/utils.py
@@ -75,8 +75,8 @@ def stdin_get_value():
return cached_value.getvalue()
-def parse_unified_diff():
- # type: () -> List[str]
+def parse_unified_diff(diff=None):
+ # type: (str) -> List[str]
"""Parse the unified diff passed on stdin.
:returns:
@@ -84,7 +84,10 @@ def parse_unified_diff():
:rtype:
dict
"""
- diff = stdin_get_value()
+ # Allow us to not have to patch out stdin_get_value
+ if diff is None:
+ diff = stdin_get_value()
+
number_of_rows = None
current_path = None
parsed_paths = collections.defaultdict(set)