Mercurial Hosting > traffic-intelligence
diff python/tests/storage.txt @ 777:ef6dd60be2e1 dev
added function to save feature trajectories
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 05 Feb 2016 17:19:13 -0500 |
parents | 36605d843be5 |
children | 1b22d81ef5ff |
line wrap: on
line diff
--- a/python/tests/storage.txt Fri Feb 05 17:17:12 2016 -0500 +++ b/python/tests/storage.txt Fri Feb 05 17:19:13 2016 -0500 @@ -1,5 +1,6 @@ >>> from storage import * >>> from StringIO import StringIO +>>> from moving import MovingObject, Point, TimeInterval >>> f = openCheck('non_existant_file.txt') File non_existant_file.txt could not be opened. @@ -15,6 +16,30 @@ >>> from os import remove >>> remove(nonexistentFilename) +>>> o1 = MovingObject.generate(Point(0.,0.), Point(1.,0.), TimeInterval(0,10)) +>>> o1.num = 2 +>>> o2 = MovingObject.generate(Point(1.,1.), Point(-0.5,-0.2), TimeInterval(0,9)) +>>> o2.num = 3 +>>> saveTrajectoriesToSqlite('test.sqlite', [o1, o2], 'feature') +>>> objects = loadTrajectoriesFromSqlite('test.sqlite', 'feature') +>>> objects[0].getNum() == o1.num +True +>>> objects[1].getNum() == o2.num +True +>>> o1.getTimeInterval() == objects[0].getTimeInterval() +True +>>> o2.getTimeInterval() == objects[1].getTimeInterval() +True +>>> o1.getVelocities() == objects[0].getVelocities() +True +>>> o2.getVelocities() == objects[1].getVelocities() +True +>>> o1.getPositions() == objects[0].getPositions() +True +>>> o2.getPositions() == objects[1].getPositions() +True +>>> remove('test.sqlite') + >>> strio = StringIO('# asdlfjasdlkj0\nsadlkfjsdlakjf') >>> readline(strio) 'sadlkfjsdlakjf'