updated null object unit tests.
This commit is contained in:
@@ -12,20 +12,20 @@ class NullTestCase(TestCase):
|
|||||||
"""
|
"""
|
||||||
self.null = Null()
|
self.null = Null()
|
||||||
|
|
||||||
def test_constructing(self):
|
def test_init(self):
|
||||||
"""
|
"""
|
||||||
Test constructing a Null object.
|
Test the init method.
|
||||||
|
|
||||||
@raise AssertionError: If the test fails.
|
@raise AssertionError: If the test fails.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
n = Null()
|
Null()
|
||||||
n = Null('value')
|
Null('value')
|
||||||
n = Null('value', param='value')
|
Null('value', param='value')
|
||||||
except:
|
except:
|
||||||
raise AssertionError()
|
raise AssertionError()
|
||||||
|
|
||||||
def test_calling(self):
|
def test_call(self):
|
||||||
"""
|
"""
|
||||||
Test calling a Null object.
|
Test calling a Null object.
|
||||||
|
|
||||||
@@ -35,9 +35,9 @@ class NullTestCase(TestCase):
|
|||||||
self.assertEquals(self.null, self.null('value'))
|
self.assertEquals(self.null, self.null('value'))
|
||||||
self.assertEquals(self.null, self.null('value', param='value'))
|
self.assertEquals(self.null, self.null('value', param='value'))
|
||||||
|
|
||||||
def test_attribute_handling(self):
|
def test_get_attribute(self):
|
||||||
"""
|
"""
|
||||||
Test attribute handling on a Null object.
|
Test getting attributes of a Null object.
|
||||||
|
|
||||||
@raise AssertionError: If the test fails.
|
@raise AssertionError: If the test fails.
|
||||||
"""
|
"""
|
||||||
@@ -51,9 +51,25 @@ class NullTestCase(TestCase):
|
|||||||
self.assertEquals(self.null, self.null.attr1.method1())
|
self.assertEquals(self.null, self.null.attr1.method1())
|
||||||
self.assertEquals(self.null, self.null.method1().attr1)
|
self.assertEquals(self.null, self.null.method1().attr1)
|
||||||
|
|
||||||
|
def test_set_attribute(self):
|
||||||
|
"""
|
||||||
|
Test setting attributes of a Null object.
|
||||||
|
|
||||||
|
@raise AssertionError: If the test fails.
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
self.null.attr1 = 'value'
|
self.null.attr1 = 'value'
|
||||||
self.null.attr1.attr2 = 'value'
|
self.null.attr1.attr2 = 'value'
|
||||||
|
except:
|
||||||
|
raise AssertionError()
|
||||||
|
|
||||||
|
def test_del_attribute(self):
|
||||||
|
"""
|
||||||
|
Test deleting an attribute of a Null object.
|
||||||
|
|
||||||
|
@raise AssertionError: If the test fails.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
del self.null.attr1
|
del self.null.attr1
|
||||||
del self.null.attr1.attr2.attr3
|
del self.null.attr1.attr2.attr3
|
||||||
except:
|
except:
|
||||||
|
|||||||
Reference in New Issue
Block a user