Skip to main content

add a comment and assertion explaining this line

ID
d501995
date
2023-05-16 08:33:20+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
47cd5a7
message
add a comment and assertion explaining this line
changed files
1 file, 4 additions

Changed files

aws/s3tree.py (6033) → aws/s3tree.py (6203)

diff --git a/aws/s3tree.py b/aws/s3tree.py
index 326a716..6be1138 100755
--- a/aws/s3tree.py
+++ b/aws/s3tree.py
@@ -130,6 +130,10 @@ def pprint_s3tree(*, bucket, tree):
         else:
             prefix_char = "└─"
 
+        # if there's only one more object left in the folder, we should
+        # just print it rather than '...1 other object'
+        assert len(tree.objects) - 3 > 1
+
         extra_objects = f"...{len(tree.objects) - 3} other objects"
         lines.append(f"{prefix_char} {termcolor.colored(extra_objects, 'blue')}")