summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2018-11-24 23:19:53 -0800
committerDamjan Marion <dmarion@me.com>2018-11-26 19:53:39 +0000
commit3d2df215bf1de516ffbd8ee3815091ca3c3a492f (patch)
treed347eb7afe8911db4d819786a0f031fa4c7bb2ea
parent6221927e9bad39c2856e844f8bc38947cb447f73 (diff)
Python3 tests: Fix asserts.
Use assert(Not)Equal() Use assert{Greater,Less}[Equal] Change-Id: I7c14570b8dce463ee13a67e9c1f10beb1a0308a8 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
-rw-r--r--test/test_ip4.py4
-rw-r--r--test/test_ip6.py4
-rw-r--r--test/test_nat.py8
-rw-r--r--test/test_neighbor.py4
-rw-r--r--test/test_sixrd.py6
5 files changed, 13 insertions, 13 deletions
diff --git a/test/test_ip4.py b/test/test_ip4.py
index ca461f1d276..bd44a0a7fc9 100644
--- a/test/test_ip4.py
+++ b/test/test_ip4.py
@@ -1147,8 +1147,8 @@ class TestIPPunt(VppTestCase):
# but not equal to the number sent, since some were policed
#
rx = self.pg1._get_capture(1)
- self.assertTrue(len(rx) > 0)
- self.assertTrue(len(rx) < len(pkts))
+ self.assertGreater(len(rx), 0)
+ self.assertLess(len(rx), len(pkts))
#
# remove the poilcer. back to full rx
diff --git a/test/test_ip6.py b/test/test_ip6.py
index 95f9229ea5a..33194ebc5b2 100644
--- a/test/test_ip6.py
+++ b/test/test_ip6.py
@@ -1920,8 +1920,8 @@ class TestIP6Punt(VppTestCase):
# but not equal to the number sent, since some were policed
#
rx = self.pg1._get_capture(1)
- self.assertTrue(len(rx) > 0)
- self.assertTrue(len(rx) < len(pkts))
+ self.assertGreater(len(rx), 0)
+ self.assertLess(len(rx), len(pkts))
#
# remove the poilcer. back to full rx
diff --git a/test/test_nat.py b/test/test_nat.py
index cf5cc63cc50..59d98d94569 100644
--- a/test/test_nat.py
+++ b/test/test_nat.py
@@ -2111,7 +2111,7 @@ class TestNAT44(MethodHolder):
# general user and session dump verifications
users = self.vapi.nat44_user_dump()
- self.assertTrue(len(users) >= 3)
+ self.assertGreaterEqual(len(users), 3)
addresses = self.vapi.nat44_address_dump()
self.assertEqual(len(addresses), 1)
for user in users:
@@ -2127,7 +2127,7 @@ class TestNAT44(MethodHolder):
# pg4 session dump
sessions = self.vapi.nat44_user_session_dump(self.pg4.remote_ip4n, 10)
- self.assertTrue(len(sessions) >= 4)
+ self.assertGreaterEqual(len(sessions), 4)
for session in sessions:
self.assertFalse(session.is_static)
self.assertEqual(session.inside_ip_address[0:4],
@@ -2137,7 +2137,7 @@ class TestNAT44(MethodHolder):
# pg6 session dump
sessions = self.vapi.nat44_user_session_dump(self.pg6.remote_ip4n, 20)
- self.assertTrue(len(sessions) >= 3)
+ self.assertGreaterEqual(len(sessions), 3)
for session in sessions:
self.assertTrue(session.is_static)
self.assertEqual(session.inside_ip_address[0:4],
@@ -4146,7 +4146,7 @@ class TestNAT44EndpointDependent(MethodHolder):
server1_n += 1
else:
server2_n += 1
- self.assertTrue(server1_n > server2_n)
+ self.assertGreater(server1_n, server2_n)
def test_static_lb_2(self):
""" NAT44 local service load balancing (asymmetrical rule) """
diff --git a/test/test_neighbor.py b/test/test_neighbor.py
index 67424048797..d551c94584a 100644
--- a/test/test_neighbor.py
+++ b/test/test_neighbor.py
@@ -1350,7 +1350,7 @@ class ARPTestCase(VppTestCase):
# how many we get is going to be dependent on the time for packet
# processing but it should be small
#
- self.assertTrue(len(rx) < 64)
+ self.assertLess(len(rx), 64)
#
# IPv6/ND
@@ -1378,7 +1378,7 @@ class ARPTestCase(VppTestCase):
# how many we get is going to be dependent on the time for packet
# processing but it should be small
#
- self.assertTrue(len(rx) < 64)
+ self.assertLess(len(rx), 64)
class NeighborStatsTestCase(VppTestCase):
diff --git a/test/test_sixrd.py b/test/test_sixrd.py
index a469ac5bab6..dbdd4b5b356 100644
--- a/test/test_sixrd.py
+++ b/test/test_sixrd.py
@@ -72,9 +72,9 @@ class Test6RD(VppTestCase):
if IP in rx:
self.fail()
- self.assertTrue(rx[IPv6].src == expected[IPv6].src)
- self.assertTrue(rx[IPv6].dst == expected[IPv6].dst)
- self.assertTrue(rx[IPv6].nh == expected[IPv6].nh)
+ self.assertEqual(rx[IPv6].src, expected[IPv6].src)
+ self.assertEqual(rx[IPv6].dst, expected[IPv6].dst)
+ self.assertEqual(rx[IPv6].nh, expected[IPv6].nh)
def payload(self, len):
return 'x' * len