Skip to content

Commit

Permalink
Second part of flake8 plugins fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Secrus committed Jul 26, 2022
1 parent ac2ef55 commit a214b62
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
26 changes: 13 additions & 13 deletions tests/solution_providers/test_solution_provider_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ def documentation_links(self) -> list[str]:
def test_it_has_no_provider_by_default():
repository = SolutionProviderRepository()

assert 0 == len(repository._solution_providers)
assert len(repository._solution_providers) == 0


def test_providers_can_be_passed_to_constructor():
repository = SolutionProviderRepository()

assert 0 == len(repository._solution_providers)
assert len(repository._solution_providers) == 0


def test_it_can_find_solutions():
Expand All @@ -61,20 +61,20 @@ def test_it_can_find_solutions():

solutions = repository.get_solutions_for_exception(ExceptionProvidingException())

assert 2 == len(solutions)
assert len(solutions) == 2
solution1 = solutions[0]
solution2 = solutions[1]
assert "A simple solution" == solution1.solution_title
assert "An exception solution" == solution2.solution_title
assert "A simple solution description" == solution1.solution_description
assert "An exception solution description" == solution2.solution_description
assert ["https://example.com"] == solution1.documentation_links
assert 0 == len(solution2.documentation_links)
assert solution1.solution_title == "A simple solution"
assert solution2.solution_title == "An exception solution"
assert solution1.solution_description == "A simple solution description"
assert solution2.solution_description == "An exception solution description"
assert solution1.documentation_links == ["https://example.com"]
assert len(solution2.documentation_links) == 0

solutions = repository.get_solutions_for_exception(ExceptionWhichIsSolution())

assert 1 == len(solutions)
assert len(solutions) == 1
solution1 = solutions[0]
assert "A solution" == solution1.solution_title
assert "A solution description" == solution1.solution_description
assert ["https://foo.bar"] == solution1.documentation_links
assert solution1.solution_title == "A solution"
assert solution1.solution_description == "A solution description"
assert solution1.documentation_links == ["https://foo.bar"]
12 changes: 6 additions & 6 deletions tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ def test_frame():
same_frame = Frame(frame_info)
assert frame_info.frame == frame.frame

assert 11 == frame.lineno
assert __file__ == frame.filename
assert "test_frame" == frame.function
assert " simple_exception()\n" == frame.line
assert frame.lineno == 11
assert frame.filename == __file__
assert frame.function == "test_frame"
assert frame.line == " simple_exception()\n"

with open(__file__) as f:
assert f.read() == frame.file_content

assert f"<Frame {__file__}, test_frame, 11>" == repr(frame)
assert repr(frame) == f"<Frame {__file__}, test_frame, 11>"

try:
nested_exception()
Expand All @@ -41,4 +41,4 @@ def test_frame():
def test_frame_with_no_context_should_return_empty_line():
frame = Frame(inspect.FrameInfo(None, "filename.py", 123, "function", None, 3))

assert "" == frame.line
assert frame.line == ""
20 changes: 10 additions & 10 deletions tests/test_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ def test_inspector_with_simple_exception():
except ValueError as e:
inspector = Inspector(e)

assert e == inspector.exception
assert inspector.exception == e
assert not inspector.has_previous_exception()
assert inspector.previous_exception is None
assert "ValueError" == inspector.exception_name
assert "Simple Exception" == inspector.exception_message
assert inspector.exception_name == "ValueError"
assert inspector.exception_message == "Simple Exception"
assert len(inspector.frames) > 0


Expand All @@ -26,13 +26,13 @@ def test_inspector_with_nested_exception():
except RuntimeError as e:
inspector = Inspector(e)

assert e == inspector.exception
assert inspector.exception == e
assert inspector.has_previous_exception()
assert inspector.previous_exception is not None
assert "RuntimeError" == inspector.exception_name
assert "Nested Exception" == inspector.exception_message
assert inspector.exception_name == "RuntimeError"
assert inspector.exception_message == "Nested Exception"
assert len(inspector.frames) > 0
assert 1 == len(inspector.frames.compact())
assert len(inspector.frames.compact()) == 1


def test_inspector_with_recursive_exception():
Expand All @@ -41,10 +41,10 @@ def test_inspector_with_recursive_exception():
except RuntimeError as e:
inspector = Inspector(e)

assert e == inspector.exception
assert inspector.exception == e
assert not inspector.has_previous_exception()
assert inspector.previous_exception is None
assert "RecursionError" == inspector.exception_name
assert "maximum recursion depth exceeded" == inspector.exception_message
assert inspector.exception_name == "RecursionError"
assert inspector.exception_message == "maximum recursion depth exceeded"
assert len(inspector.frames) > 0
assert len(inspector.frames) > len(inspector.frames.compact())

0 comments on commit a214b62

Please sign in to comment.