diff --git a/.gitignore b/.gitignore index f855e00..c646f69 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ build/ .coverage htmlcov +*.xml diff --git a/pysnooper/tracer.py b/pysnooper/tracer.py index ba34c27..a977dab 100644 --- a/pysnooper/tracer.py +++ b/pysnooper/tracer.py @@ -505,7 +505,7 @@ class Tracer: exception = '\n'.join(traceback.format_exception_only(*arg[:2])).strip() if self.max_variable_length: exception = utils.truncate(exception, self.max_variable_length) - self.write('{indent}Exception:..... {exception}'. + self.write('\033[31m' + '{indent}Exception:..... {exception}'. format(**locals())) return self.trace diff --git a/pysnooper/variables.py b/pysnooper/variables.py index 2229c38..d286333 100644 --- a/pysnooper/variables.py +++ b/pysnooper/variables.py @@ -1,5 +1,6 @@ import itertools import abc + try: from collections.abc import Mapping, Sequence except ImportError: @@ -47,7 +48,7 @@ class BaseVariable(pycompat.ABC): def __eq__(self, other): return (isinstance(other, BaseVariable) and - self._fingerprint == other._fingerprint) + self._fingerprint == other._fingerprint) class CommonVariable(BaseVariable): diff --git a/test1.py b/test1.py new file mode 100644 index 0000000..b6156c0 --- /dev/null +++ b/test1.py @@ -0,0 +1,18 @@ +import pysnooper + +@pysnooper.snoop() +def bubble(number): + a = [5, 0, 2, 3, 6, 9, 1, 7, 4] + if number == 1: + for i in range(0,11): + for j in range(i, 9): + if(a[j] < a[i]): + temp = a[i] + a[i] = a[j] + a[j] = temp + return a + + else: + return [0] + +print(bubble(0)) \ No newline at end of file