diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2017-11-23 14:33:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-23 14:33:12 (GMT) |
commit | 4b3042900e7e8dc120408bab86642c09c9d25a5a (patch) | |
tree | 0ad2092325d91b325a83d28b1846cbe07df4ed94 /Lib/test | |
parent | ae3c5c7b9e5e5ba53213e12cc100e32415d5762c (diff) | |
download | cpython-4b3042900e7e8dc120408bab86642c09c9d25a5a.zip cpython-4b3042900e7e8dc120408bab86642c09c9d25a5a.tar.gz cpython-4b3042900e7e8dc120408bab86642c09c9d25a5a.tar.bz2 |
bpo-1102: View.Fetch() now returns None when it's exhausted (GH-4459)
(cherry picked from commit bdb8315c21825487b54852ff0511fb4881ea2181)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_msilib.py | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/Lib/test/test_msilib.py b/Lib/test/test_msilib.py index f656f72..aa19883 100644 --- a/Lib/test/test_msilib.py +++ b/Lib/test/test_msilib.py @@ -1,7 +1,45 @@ """ Test suite for the code in msilib """ import unittest -from test.support import import_module +from test.support import TESTFN, import_module, unlink msilib = import_module('msilib') +import msilib.schema + + +def init_database(): + path = TESTFN + '.msi' + db = msilib.init_database( + path, + msilib.schema, + 'Python Tests', + 'product_code', + '1.0', + 'PSF', + ) + return db, path + + +class MsiDatabaseTestCase(unittest.TestCase): + + def test_view_fetch_returns_none(self): + db, db_path = init_database() + properties = [] + view = db.OpenView('SELECT Property, Value FROM Property') + view.Execute(None) + while True: + record = view.Fetch() + if record is None: + break + properties.append(record.GetString(1)) + view.Close() + self.assertEqual( + properties, + [ + 'ProductName', 'ProductCode', 'ProductVersion', + 'Manufacturer', 'ProductLanguage', + ] + ) + self.addCleanup(unlink, db_path) + class Test_make_id(unittest.TestCase): #http://msdn.microsoft.com/en-us/library/aa369212(v=vs.85).aspx |