aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2011-02-09 12:02:36 -0700
committerMartin Jansa <Martin.Jansa@gmail.com>2011-04-22 16:39:27 +0200
commit06cbeedcc953b788886580f1f9d4b7de7a10d102 (patch)
tree39c11cdc2248b544a9e1703f777435ad27b17964
parent21d6180cc4f70635890d2e986438ab2309faf3ec (diff)
downloadopenembedded-06cbeedcc953b788886580f1f9d4b7de7a10d102.zip
openembedded-06cbeedcc953b788886580f1f9d4b7de7a10d102.tar.gz
openembedded-06cbeedcc953b788886580f1f9d4b7de7a10d102.tar.bz2
oe.test_types: improve naming/organization
Signed-off-by: Chris Larson <chris_larson@mentor.com>
-rw-r--r--lib/oe/test_types.py46
1 files changed, 26 insertions, 20 deletions
diff --git a/lib/oe/test_types.py b/lib/oe/test_types.py
index 494abfa..f2e4387 100644
--- a/lib/oe/test_types.py
+++ b/lib/oe/test_types.py
@@ -9,33 +9,39 @@ class TestTypes(unittest.TestCase):
return self.assertFalse(obj is other)
def assertFactoryCreated(self, value, type, **flags):
- obj = factory(type)
- self.assertIsNot(obj, None)
- self.assertIsInstance(create(value, type, **flags), obj)
+ cls = factory(type)
+ self.assertIsNot(cls, None)
+ self.assertIsInstance(create(value, type, **flags), cls)
class TestBooleanType(TestTypes):
- def test_boolean(self):
+ def test_invalid(self):
self.assertRaises(ValueError, create, '', 'boolean')
self.assertRaises(ValueError, create, 'foo', 'boolean')
self.assertRaises(TypeError, create, object(), 'boolean')
- def test_boolean_true(self):
- self.assertEqual(create('y', 'boolean'), True)
- self.assertEqual(create('yes', 'boolean'), True)
- self.assertEqual(create('1', 'boolean'), True)
- self.assertEqual(create('t', 'boolean'), True)
- self.assertEqual(create('true', 'boolean'), True)
- self.assertEqual(create('TRUE', 'boolean'), True)
- self.assertEqual(create('truE', 'boolean'), True)
-
- def test_boolean_false(self):
+ def test_true(self):
+ self.assertTrue(create('y', 'boolean'))
+ self.assertTrue(create('yes', 'boolean'))
+ self.assertTrue(create('1', 'boolean'))
+ self.assertTrue(create('t', 'boolean'))
+ self.assertTrue(create('true', 'boolean'))
+ self.assertTrue(create('TRUE', 'boolean'))
+ self.assertTrue(create('truE', 'boolean'))
+
+ def test_false(self):
+ self.assertFalse(create('n', 'boolean'))
+ self.assertFalse(create('no', 'boolean'))
+ self.assertFalse(create('0', 'boolean'))
+ self.assertFalse(create('f', 'boolean'))
+ self.assertFalse(create('false', 'boolean'))
+ self.assertFalse(create('FALSE', 'boolean'))
+ self.assertFalse(create('faLse', 'boolean'))
+
+ def test_bool_equality(self):
self.assertEqual(create('n', 'boolean'), False)
- self.assertEqual(create('no', 'boolean'), False)
- self.assertEqual(create('0', 'boolean'), False)
- self.assertEqual(create('f', 'boolean'), False)
- self.assertEqual(create('false', 'boolean'), False)
- self.assertEqual(create('FALSE', 'boolean'), False)
- self.assertEqual(create('faLse', 'boolean'), False)
+ self.assertNotEqual(create('n', 'boolean'), True)
+ self.assertEqual(create('y', 'boolean'), True)
+ self.assertNotEqual(create('y', 'boolean'), False)
class TestList(TestTypes):
def assertListEqual(self, value, valid, sep=None):