From eae9ebed12d26832405c2f29fbdb14b4babf080d Mon Sep 17 00:00:00 2001 From: Andrew Gorcester Date: Mon, 23 Oct 2023 15:06:13 -0700 Subject: [PATCH] fix: fix typo in Bucket.clear_lifecycle_rules() (#1169) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #1074 🦕 --- google/cloud/storage/bucket.py | 6 +++++- tests/unit/test_bucket.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/google/cloud/storage/bucket.py b/google/cloud/storage/bucket.py index f6d5e5aa2..3809a94b9 100644 --- a/google/cloud/storage/bucket.py +++ b/google/cloud/storage/bucket.py @@ -2275,7 +2275,7 @@ def lifecycle_rules(self, rules): rules = [dict(rule) for rule in rules] # Convert helpers if needed self._patch_property("lifecycle", {"rule": rules}) - def clear_lifecyle_rules(self): + def clear_lifecycle_rules(self): """Clear lifecycle rules configured for this bucket. See https://cloud.google.com/storage/docs/lifecycle and @@ -2283,6 +2283,10 @@ def clear_lifecyle_rules(self): """ self.lifecycle_rules = [] + def clear_lifecyle_rules(self): + """Deprecated alias for clear_lifecycle_rules.""" + return self.clear_lifecycle_rules() + def add_lifecycle_delete_rule(self, **kw): """Add a "delete" rule to lifecycle rules configured for this bucket. diff --git a/tests/unit/test_bucket.py b/tests/unit/test_bucket.py index 0c0873ee4..3f26fff2f 100644 --- a/tests/unit/test_bucket.py +++ b/tests/unit/test_bucket.py @@ -2448,6 +2448,7 @@ def test_clear_lifecycle_rules(self): bucket._properties["lifecycle"] = {"rule": rules} self.assertEqual(list(bucket.lifecycle_rules), rules) + # This is a deprecated alias and will test both methods bucket.clear_lifecyle_rules() self.assertEqual(list(bucket.lifecycle_rules), [])