Use assertIn and assertNotIn

Bug #1510007 reported by Bertrand Lallau
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Designate
Fix Released
Undecided
Bertrand Lallau
Ironic
Fix Released
Low
Unassigned
Magnum
Fix Released
Undecided
Bertrand Lallau
ironic-python-agent
Fix Released
Low
edan david

Bug Description

Tests should use:
  self.assertIn(value, list)
  self.assertNotIn(value, list)

instead of:
  self.assertTrue(value in list)
  self.assertFalse(value in list)

because assertIn and assertNotIn raise more meaningful errors:
  self.assertIn(3, [1, 2]
  >>> MismatchError: 3 not in [1, 2]

  self.assertTrue(3 in [1, 2])
  >>> AssertionError: False is not true

Changed in magnum:
assignee: nobody → Bertrand Lallau (bertrand-lallau)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to designate (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/239417

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to heat (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/239471

Revision history for this message
Cedric Brandily (cbrandily) wrote :
Changed in heat:
assignee: nobody → Bertrand Lallau (bertrand-lallau)
status: New → In Progress
Changed in designate:
assignee: nobody → Bertrand Lallau (bertrand-lallau)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/239471
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=1216d357f04b66f93245da948c9892435733d31c
Submitter: Jenkins
Branch: master

commit 1216d357f04b66f93245da948c9892435733d31c
Author: Bertrand Lallau <email address hidden>
Date: Mon Oct 26 16:43:42 2015 +0100

    Use assertIn and assertNotIn

    Tests should use:
      self.assertIn(value, list)
      self.assertNotIn(value, list)

    instead of:
      self.assertTrue(value in list)
      self.assertFalse(value in list)

    because assertIn and assertNotIn raise more meaningful errors:
      self.assertIn(3, [1, 2]
      >>> MismatchError: 3 not in [1, 2]

      self.assertTrue(3 in [1, 2])
      >>> AssertionError: False is not true

    Change-Id: I4b24b6e00bf26c0a68a9d8f9eb9185c435791dfc
    Closes-Bug: #1510007

Changed in heat:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to magnum (master)

Reviewed: https://review.openstack.org/239357
Committed: https://git.openstack.org/cgit/openstack/magnum/commit/?id=798c7e35ef4b27e81098ab2e4fb03976199ae57b
Submitter: Jenkins
Branch: master

commit 798c7e35ef4b27e81098ab2e4fb03976199ae57b
Author: Bertrand Lallau <email address hidden>
Date: Mon Oct 26 08:25:07 2015 +0100

    Use assertIn and assertNotIn

    Tests should use:
      self.assertIn(value, list)
      self.assertNotIn(value, list)

    instead of:
      self.assertTrue(value in list)
      self.assertFalse(value in list)

    because assertIn and assertNotIn raise more meaningful errors:
      self.assertIn(3, [1, 2])
      >>> MismatchError: 3 not in [1, 2]

      self.assertTrue(3 in [1, 2])
      >>> AssertionError: False is not true

    Closes-Bug: #1510007
    Change-Id: If33252cc93c06a85e61871fb7b22b726f4a08500

Changed in magnum:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (master)

Reviewed: https://review.openstack.org/239417
Committed: https://git.openstack.org/cgit/openstack/designate/commit/?id=92a08f122982a9387e66717672c0002889aed452
Submitter: Jenkins
Branch: master

commit 92a08f122982a9387e66717672c0002889aed452
Author: Bertrand Lallau <email address hidden>
Date: Mon Oct 26 13:08:40 2015 +0100

    Use assertIn and assertNotIn

    Tests should use:
      self.assertIn(value, list)
      self.assertNotIn(value, list)

    instead of:
      self.assertTrue(value in list)
      self.assertFalse(value in list)

    because assertIn and assertNotIn raise more meaningful errors:
      self.assertIn(3, [1, 2]
      >>> MismatchError: 3 not in [1, 2]

      self.assertTrue(3 in [1, 2])
      >>> AssertionError: False is not true

    Change-Id: I38bf94b50dbfff8aa075b8ecbb5b4d03a2cdf2e2
    Closes-Bug: #1510007

Changed in designate:
status: In Progress → Fix Committed
Adrian Otto (aotto)
Changed in magnum:
milestone: none → mitaka-1
status: Fix Committed → Fix Released
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/heat 6.0.0.0b1

This issue was fixed in the openstack/heat 6.0.0.0b1 development milestone.

Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/designate 2.0.0.0b1

This issue was fixed in the openstack/designate 2.0.0.0b1 development milestone.

Changed in designate:
status: Fix Committed → Fix Released
Changed in heat:
status: Fix Committed → Fix Released
tags: added: low-hanging-fruit
Changed in ironic:
assignee: nobody → Ramamani Yeleswarapu (ramamani-yeleswarapu)
Dmitry Tantsur (divius)
Changed in ironic:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ironic (master)

Fix proposed to branch: master
Review: https://review.openstack.org/330474

Changed in ironic:
assignee: Ramamani Yeleswarapu (ramamani-yeleswarapu) → edan david (edand)
status: Triaged → In Progress
Ruby Loo (rloo)
affects: ironic → ironic-python-agent
Changed in ironic:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic-python-agent (master)

Reviewed: https://review.openstack.org/330451
Committed: https://git.openstack.org/cgit/openstack/ironic-python-agent/commit/?id=1e8652a8d038c3795b903c9eba02a6b0a8a5b872
Submitter: Jenkins
Branch: master

commit 1e8652a8d038c3795b903c9eba02a6b0a8a5b872
Author: Edan David <email address hidden>
Date: Thu Jun 16 06:40:03 2016 -0400

    Use assertIn and assertNotIn

    Tests should use:
      self.assertIn(value, list)
      self.assertNotIn(value, list)

    instead of:
      self.assertTrue(value in list)
      self.assertFalse(value in list)

    because assertIn and assertNotIn raise more meaningful errors:
      self.assertIn(3, [1, 2]
      >>> MismatchError: 3 not in [1, 2]

      self.assertTrue(3 in [1, 2])
      >>> AssertionError: False is not true

    Change-Id: I2d1c78fe71fe03e350b1035123b0a48b7186a6ec
    Closes-Bug: #1510007

Changed in ironic-python-agent:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic (master)

Reviewed: https://review.openstack.org/330474
Committed: https://git.openstack.org/cgit/openstack/ironic/commit/?id=3c14090d036444c6a68028de5981778c9986bb88
Submitter: Jenkins
Branch: master

commit 3c14090d036444c6a68028de5981778c9986bb88
Author: Edan David <email address hidden>
Date: Thu Jun 16 07:12:18 2016 -0400

    Use assertIn and assertNotIn

    Tests should use:
      self.assertIn(value, list)
      self.assertNotIn(value, list)

    instead of:
      self.assertTrue(value in list)
      self.assertFalse(value in list)

    because assertIn and assertNotIn raise more meaningful errors:
      self.assertIn(3, [1, 2]
      >>> MismatchError: 3 not in [1, 2]

      self.assertTrue(3 in [1, 2])
      >>> AssertionError: False is not true

    Change-Id: Ic2461afd9872767fe615064610daffb52e743388
    Closes-Bug: #1510007

Changed in ironic:
status: New → Fix Released
Thomas Herve (therve)
no longer affects: heat
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/ironic-python-agent 1.3.0

This issue was fixed in the openstack/ironic-python-agent 1.3.0 release.

Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/ironic 6.0.0

This issue was fixed in the openstack/ironic 6.0.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.