mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 07:01:22 -07:00
Fix assert statement syntax
`assert (condition, message)` gets parsed by Python as `assert a_two_tuple`, and a 2-element tuple is never False. Discovered by compileall on Python 3.4, which emits a SyntaxWarning for this common mistake.
This commit is contained in:
parent
9e82ecaf91
commit
c846bab69b
1 changed files with 2 additions and 2 deletions
4
test/integration/cleanup_rax.py
Normal file → Executable file
4
test/integration/cleanup_rax.py
Normal file → Executable file
|
@ -54,8 +54,8 @@ def authenticate():
|
||||||
def prompt_and_delete(item, prompt, assumeyes):
|
def prompt_and_delete(item, prompt, assumeyes):
|
||||||
if not assumeyes:
|
if not assumeyes:
|
||||||
assumeyes = raw_input(prompt).lower() == 'y'
|
assumeyes = raw_input(prompt).lower() == 'y'
|
||||||
assert (hasattr(item, 'delete') or hasattr(item, 'terminate'),
|
assert hasattr(item, 'delete') or hasattr(item, 'terminate'), \
|
||||||
"Class <%s> has no delete or terminate attribute" % item.__class__)
|
"Class <%s> has no delete or terminate attribute" % item.__class__
|
||||||
if assumeyes:
|
if assumeyes:
|
||||||
if hasattr(item, 'delete'):
|
if hasattr(item, 'delete'):
|
||||||
item.delete()
|
item.delete()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue