Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b8189f3

Browse files
author
Thomas Heller
committed
Add a comment to explain why we have to restore the original value.
1 parent 3536a5c commit b8189f3

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Lib/ctypes/test/test_values.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@
1010
class ValuesTestCase(unittest.TestCase):
1111

1212
def test_an_integer(self):
13+
# This test checks and changes an integer stored inside the
14+
# _ctypes_test dll/shared lib.
1315
ctdll = CDLL(_ctypes_test.__file__)
1416
an_integer = c_int.in_dll(ctdll, "an_integer")
1517
x = an_integer.value
1618
self.failUnlessEqual(x, ctdll.get_an_integer())
1719
an_integer.value *= 2
1820
self.failUnlessEqual(x*2, ctdll.get_an_integer())
21+
# To avoid test failures when this test is repeated several
22+
# times the original value must be restored
1923
an_integer.value = x
2024
self.failUnlessEqual(x, ctdll.get_an_integer())
2125

0 commit comments

Comments
 (0)