Skip to content

Commit

Permalink
test: run ruff format over test_svg.py (#729)
Browse files Browse the repository at this point in the history
  • Loading branch information
whot authored Jun 19, 2024
1 parent 7d48cff commit 6a802c1
Showing 1 changed file with 29 additions and 8 deletions.
37 changes: 29 additions & 8 deletions test/test_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ def has_item(self, id: str, classes: Optional[List[str]] = None):

def is_autogenerated(svg_filename: Path):
tabletfile = datadir() / svg_filename.name.replace(".svg", ".tablet")
return any("autogenerated" in l for l in open(tabletfile)) if tabletfile.exists() else False
return (
any("autogenerated" in l for l in open(tabletfile))
if tabletfile.exists()
else False
)


def pytest_generate_tests(metafunc):
Expand All @@ -68,7 +72,12 @@ def pytest_generate_tests(metafunc):
db = load_test_db()
devices = db.list_devices()
devices = [
SvgDevice(db, d, load_svg(d.layout_filename), is_autogenerated(Path(d.layout_filename)))
SvgDevice(
db,
d,
load_svg(d.layout_filename),
is_autogenerated(Path(d.layout_filename)),
)
for d in devices
if d.layout_filename
]
Expand Down Expand Up @@ -149,11 +158,15 @@ def test_svg_strips(stripdevice):
try:
if stripdevice.device.num_strips >= 1:
stripdevice.has_item(id="Strip", classes=["Strip", "TouchStrip"])
stripdevice.has_item(id="LabelStripUp", classes=["StripUp", "Strip", "Label"])
stripdevice.has_item(
id="LabelStripUp", classes=["StripUp", "Strip", "Label"]
)
stripdevice.has_item(
id="LabelStripDown", classes=["StripDown", "Strip", "Label"]
)
stripdevice.has_item(id="LeaderStripUp", classes=["StripUp", "Strip", "Leader"])
stripdevice.has_item(
id="LeaderStripUp", classes=["StripUp", "Strip", "Leader"]
)
stripdevice.has_item(
id="LeaderStripDown", classes=["StripDown", "Strip", "Leader"]
)
Expand Down Expand Up @@ -185,13 +198,21 @@ def test_svg_dials(dialdevice):
dialdevice.has_item(id="LabelDialCW", classes=["DialCW", "Dial", "Label"])
dialdevice.has_item(id="LabelDialCCW", classes=["DialCCW", "Dial", "Label"])
dialdevice.has_item(id="LeaderDialCW", classes=["DialCW", "Dial", "Leader"])
dialdevice.has_item(id="LeaderDialCCW", classes=["DialCCW", "Dial", "Leader"])
dialdevice.has_item(
id="LeaderDialCCW", classes=["DialCCW", "Dial", "Leader"]
)

if dialdevice.device.num_dials >= 2:
dialdevice.has_item(id="Dial2", classes=["Dial2", "TouchDial"])
dialdevice.has_item(id="LabelDial2CW", classes=["Dial2CW", "Dial2", "Label"])
dialdevice.has_item(id="LabelDial2CCW", classes=["Dial2CCW", "Dial2", "Label"])
dialdevice.has_item(id="LeaderDial2CW", classes=["Dial2CW", "Dial2", "Leader"])
dialdevice.has_item(
id="LabelDial2CW", classes=["Dial2CW", "Dial2", "Label"]
)
dialdevice.has_item(
id="LabelDial2CCW", classes=["Dial2CCW", "Dial2", "Label"]
)
dialdevice.has_item(
id="LeaderDial2CW", classes=["Dial2CW", "Dial2", "Leader"]
)
dialdevice.has_item(
id="LeaderDial2CCW", classes=["Dial2CCW", "Dial2", "Leader"]
)
Expand Down

0 comments on commit 6a802c1

Please sign in to comment.