Mercurial > hg > audiodb
annotate bindings/python/tests/InitialisationRelated.py @ 704:df35c9c976a0
Redoing feature selector to be a little more verbose.
author | mas01mj |
---|---|
date | Fri, 30 Apr 2010 16:29:14 +0000 |
parents | 01af8c56eb8d |
children | 159becb0701e |
rev | line source |
---|---|
map01bf@662 | 1 #!/usr/bin/env python |
map01bf@662 | 2 # encoding: utf-8 |
map01bf@662 | 3 """ |
map01bf@662 | 4 InitialisationRelated.py |
map01bf@662 | 5 |
map01bf@662 | 6 designed to mirror the numbering for the C/C++ api's unit tests |
map01bf@662 | 7 this performs tests 0001, 0002, 0003 |
map01bf@662 | 8 |
map01bf@662 | 9 |
map01bf@662 | 10 Created by Ben Fields on 2010-01-11. |
map01bf@662 | 11 """ |
map01bf@662 | 12 |
map01bf@662 | 13 import sys |
map01bf@662 | 14 import os,os.path |
map01bf@662 | 15 import pyadb |
map01bf@662 | 16 import struct |
map01bf@662 | 17 import unittest |
map01bf@662 | 18 |
map01bf@662 | 19 |
map01bf@662 | 20 class CreateADBTests(unittest.TestCase): |
map01bf@662 | 21 def setUp(self): |
map01bf@662 | 22 self.adb = pyadb.Pyadb("test.adb") |
map01bf@662 | 23 def test_DBcreation(self): |
map01bf@662 | 24 self.assert_(os.path.exists(self.adb.path)) |
map01bf@662 | 25 self.assertRaises(TypeError, pyadb.Pyadb) |
map01bf@662 | 26 def test_DBstatus(self): |
map01bf@662 | 27 try: |
map01bf@662 | 28 self.adb.status() |
map01bf@662 | 29 except: |
map01bf@662 | 30 self.assert_(False) |
map01bf@662 | 31 def test_1DinsertionSelfQuery(self): |
map01bf@662 | 32 tH = open("testfeature", 'w') |
map01bf@662 | 33 tH.write(struct.pack("=id",1,1)) |
map01bf@662 | 34 tH.close() |
map01bf@662 | 35 self.adb.insert("testfeature") |
map01bf@662 | 36 self.adb.configQuery["seqLength"] = 1 |
map01bf@662 | 37 result = self.adb.query("testfeature") |
map01bf@662 | 38 self.assert_(len(result.rawData) == 1) |
map01bf@662 | 39 self.assert_(result.rawData.has_key("testfeature")) |
map01bf@662 | 40 self.assert_(len(result.rawData["testfeature"]) == 1) |
map01bf@662 | 41 self.assert_(result.rawData["testfeature"][0] == (float("-inf"), 0,0)) |
map01bf@662 | 42 |
map01bf@662 | 43 |
map01bf@662 | 44 |
map01bf@662 | 45 |
map01bf@662 | 46 if __name__ == '__main__': |
map01bf@662 | 47 unittest.main() |