fix(pyright): assert not None before accessing datetime attributes in tests
test / integration (pull_request) Successful in 10s
lint / lint (push) Successful in 42s
test / coverage (pull_request) Successful in 40s
test / unit (pull_request) Successful in 1m32s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-19 01:10:18 +00:00
parent 6082e92b46
commit 8458b221d9
2 changed files with 8 additions and 0 deletions
+6
View File
@@ -338,6 +338,8 @@ class TestMacosContainerImageCreatedAt(unittest.TestCase):
payload = '[{"created": "2025-06-01T12:00:00"}]'
with patch.object(util.subprocess, "run", return_value=self._ok(payload)):
dt = util.image_created_at("bot-bottle-agent:latest")
self.assertIsNotNone(dt)
assert dt is not None
self.assertEqual(2025, dt.year)
self.assertEqual(6, dt.month)
self.assertEqual(1, dt.day)
@@ -347,12 +349,16 @@ class TestMacosContainerImageCreatedAt(unittest.TestCase):
payload = '[{"created": "2024-01-15T08:30:00"}]'
with patch.object(util.subprocess, "run", return_value=self._ok(payload)):
dt = util.image_created_at("some-image:latest")
self.assertIsNotNone(dt)
assert dt is not None
self.assertEqual(2024, dt.year)
def test_accepts_uppercase_Created_field(self):
payload = '[{"Created": "2024-03-20T10:00:00"}]'
with patch.object(util.subprocess, "run", return_value=self._ok(payload)):
dt = util.image_created_at("some-image:latest")
self.assertIsNotNone(dt)
assert dt is not None
self.assertEqual(2024, dt.year)
self.assertEqual(3, dt.month)