psyinfra / onyo

text-based inventory system on top of git
ISC License
3 stars 5 forks source link

BF: Empty assets should not serialize to literal '{}' #664

Closed aqw closed 1 month ago

aqw commented 1 month ago

New empty assets would have a literal "{}" as their content (and diffs would also include the "{}").

This removes the spurious {}.

My first approach was to pass None or '' to yaml.dump(), but both serialized to non-empty strings. So the only option is to explicitly return what an empty file should be.

I was unsure where to put the tests, but I settled on edit partly by choice and partly by accident. This bug was already inadvertently documented in those tests. And I do think that editing with printf is a relatively easy and intuitive place to verify that the content is precisely what we expect.

close #663

TobiasKadelka commented 1 month ago

LGTM!