Earlier quoted context omitted.
OOC what are your grips with black's style? I generally find black pretty "beautiful" ( concise maybe not as much).
I guess the closing parens irk me the most e.g. assert outputs.get("foo.bar.baz", "default") == pytest.approx( time_recorder.time_taken, abs=0.0001 ) I get why it's done that, but I just don't think it helps humans read. Part of the twisted beauty of PEP-008's narrow lines is that you're forced to extract (named) variables, or avoid overly indented code by extracting methods or applying higher level abstractions. In…
Using the same three lines, you could instead assign each result to a temporary var:
x = outputs.get("foo.bar.baz", "default")
y = pytest.approx(time_recorder.time_taken, abs=0.0001)
assert x == y
If using an assert method, I think this looks okay too (although still a bit noisy): self.assertEqual(
outputs.get("foo.bar.baz", "default"),
pytest.approx(time_recorder.time_taken, abs=0.0001),
)
I find that if black produces ugly output, it's usually because of something that I could improve, and I appreciate the hint.