Commit 607372e2 authored by Martín Ferrari's avatar Martín Ferrari

Compress repeated asserts.

parent 006576a6
...@@ -37,20 +37,10 @@ class TestIPRouteStuff(unittest.TestCase): ...@@ -37,20 +37,10 @@ class TestIPRouteStuff(unittest.TestCase):
def test_any_to_bool(self): def test_any_to_bool(self):
a2b = nemu.iproute._any_to_bool a2b = nemu.iproute._any_to_bool
self.assertTrue(a2b(True)) for i in (True, 2, 'trUe', '1', 'foo', 1.0, [1]):
self.assertTrue(a2b(2)) self.assertTrue(a2b(i))
self.assertTrue(a2b('trUe')) for i in (False, 0, 'falsE', '0', '', 0.0, []):
self.assertTrue(a2b('1')) self.assertFalse(a2b(i))
self.assertTrue(a2b('foo'))
self.assertTrue(a2b(1.0))
self.assertTrue(a2b([1]))
self.assertFalse(a2b(False))
self.assertFalse(a2b(0))
self.assertFalse(a2b('falsE'))
self.assertFalse(a2b('0'))
self.assertFalse(a2b(''))
self.assertFalse(a2b(0.0))
self.assertFalse(a2b([]))
def test_non_empty_str(self): def test_non_empty_str(self):
nes = nemu.iproute._non_empty_str nes = nemu.iproute._non_empty_str
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment