Spec.format: print false attributes if requested (#37932)

This commit is contained in:
Greg Becker 2023-06-01 00:08:45 -07:00 committed by GitHub
parent 3bb86418b8
commit dace0316a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -4333,7 +4333,7 @@ def write_attribute(spec, attribute, color):
if callable(current):
raise SpecFormatStringError("Attempted to format callable object")
if not current:
if current is None:
# We're not printing anything
return

View File

@ -660,6 +660,7 @@ def test_spec_formatting(self, default_mock_concretization):
("{architecture.os}", "", "os", lambda spec: spec.architecture),
("{architecture.target}", "", "target", lambda spec: spec.architecture),
("{prefix}", "", "prefix", lambda spec: spec),
("{external}", "", "external", lambda spec: spec), # test we print "False"
]
hash_segments = [