launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #06920
[Merge] lp:~allenap/maas/assert-not-for-decisions into lp:maas
Gavin Panella has proposed merging lp:~allenap/maas/assert-not-for-decisions into lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~allenap/maas/assert-not-for-decisions/+merge/99816
Because:
$ python -O -c 'assert False'
--
https://code.launchpad.net/~allenap/maas/assert-not-for-decisions/+merge/99816
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/maas/assert-not-for-decisions into lp:maas.
=== modified file 'src/metadataserver/fields.py'
--- src/metadataserver/fields.py 2012-03-19 17:05:35 +0000
+++ src/metadataserver/fields.py 2012-03-28 20:19:18 +0000
@@ -48,8 +48,9 @@
this constructor will refuse to render None as b'None'.
:type initializer: bytes
"""
- assert isinstance(initializer, bytes), (
- "Not a binary string: '%s'" % repr(initializer))
+ if not isinstance(initializer, bytes):
+ raise AssertionError(
+ "Not a binary string: '%s'" % repr(initializer))
super(Bin, self).__init__(initializer)
=== modified file 'src/provisioningserver/cobblercatcher.py'
--- src/provisioningserver/cobblercatcher.py 2012-03-19 04:47:43 +0000
+++ src/provisioningserver/cobblercatcher.py 2012-03-28 20:19:18 +0000
@@ -83,8 +83,10 @@
:rtype: :class:`ProvisioningError`
"""
assert isinstance(fault, Fault)
- assert not isinstance(fault, ProvisioningError), (
- "Fault went through double conversion.")
+
+ if isinstance(fault, ProvisioningError):
+ raise AssertionError(
+ "Fault %r went through double conversion." % fault)
err_str = extract_text(fault.faultString)
if fault.faultCode != 1:
=== modified file 'src/provisioningserver/cobblerclient.py'
--- src/provisioningserver/cobblerclient.py 2012-03-19 04:47:43 +0000
+++ src/provisioningserver/cobblerclient.py 2012-03-28 20:19:18 +0000
@@ -405,9 +405,10 @@
return attribute_name
attribute_name = attribute_name.replace('-', '_')
- assert attribute_name in attributes, (
- "Unknown attribute for %s: %s."
- % (cls.object_type, attribute_name))
+ if attribute_name not in attributes:
+ raise AssertionError(
+ "Unknown attribute for %s: %s." % (
+ cls.object_type, attribute_name))
return attribute_name
@classmethod