Skip to content

Commit 586b923

Browse files
committed
Print only if the difference is nonempty
1 parent 8224ed3 commit 586b923

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

tests/check_public_api.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,19 @@ def main():
145145
print()
146146

147147
so_only = so_symbols.difference(header_symbols)
148-
print("The following %d symbols are exported in binary, "
149-
"but are not present in public header files:" % len(so_only))
150-
for s in sorted(so_only):
151-
print(s)
152-
print()
148+
if so_only:
149+
print("The following %d symbols are exported in binary, "
150+
"but are not present in public header files:" % len(so_only))
151+
for s in sorted(so_only):
152+
print(s)
153+
print()
153154

154155
header_only = header_symbols.difference(so_symbols)
155-
print("The following %d symbols are present in public header files, "
156-
"but are not exported in binary:" % len(header_only))
157-
for s in sorted(header_only):
158-
print(s)
156+
if header_only:
157+
print("The following %d symbols are present in public header files, "
158+
"but are not exported in binary:" % len(header_only))
159+
for s in sorted(header_only):
160+
print(s)
159161

160162

161163
if __name__ == "__main__":

0 commit comments

Comments
 (0)