Add a comment to explain why we have to restore the original value.

This commit is contained in:
Thomas Heller 2007-12-12 20:01:44 +00:00
parent 3536a5c09c
commit b8189f3b5a
1 changed files with 4 additions and 0 deletions

View File

@ -10,12 +10,16 @@ import _ctypes_test
class ValuesTestCase(unittest.TestCase):
def test_an_integer(self):
# This test checks and changes an integer stored inside the
# _ctypes_test dll/shared lib.
ctdll = CDLL(_ctypes_test.__file__)
an_integer = c_int.in_dll(ctdll, "an_integer")
x = an_integer.value
self.failUnlessEqual(x, ctdll.get_an_integer())
an_integer.value *= 2
self.failUnlessEqual(x*2, ctdll.get_an_integer())
# To avoid test failures when this test is repeated several
# times the original value must be restored
an_integer.value = x
self.failUnlessEqual(x, ctdll.get_an_integer())