by zahlman · 12mo ago · 0 comments
av1_videos = {
p
for p in glob.glob("**/*.mp4", recursive=True)
if is_av1_video(p)
}
assert av1_videos == set()
Building a set just to check if it's empty is a bit more complexity than necessary. A more direct way that also bails out early: assert not any(is_av1_video(p) for p in glob.glob("**/*.mp4", recursive=True))
Equivalently (de Morgan's law): assert all(not is_av1_video(p) for p in glob.glob("**/*.mp4", recursive=True))If it bails out early it is of no use to them.
> This means that if the test fails, I can see all the affected videos at once. If the test failed on the first AV1 video, I’d only know about one video at a time, which would slow me down.