Mercurial > hg > nsaunier > traffic-intelligence
comparison trafficintelligence/tests/storage.txt @ 1056:093e2b892ede
integrating additions to storage.py
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Mon, 09 Jul 2018 16:01:15 -0400 |
| parents | aafbc0bab925 |
| children | a7ada64b8214 |
comparison
equal
deleted
inserted
replaced
| 1055:9e4e80fc5943 | 1056:093e2b892ede |
|---|---|
| 1 >>> from io import StringIO | 1 >>> from io import StringIO |
| 2 >>> from os import remove | |
| 2 >>> from trafficintelligence.storage import * | 3 >>> from trafficintelligence.storage import * |
| 3 >>> from trafficintelligence.utils import openCheck, readline | 4 >>> from trafficintelligence.utils import openCheck, readline |
| 4 >>> from trafficintelligence.moving import MovingObject, Point, TimeInterval, Trajectory, prepareSplines | 5 >>> from trafficintelligence.moving import MovingObject, Point, TimeInterval, Trajectory, prepareSplines |
| 5 | 6 |
| 6 >>> f = openCheck('non_existant_file.txt') | 7 >>> f = openCheck('non_existant_file.txt') |
| 7 File non_existant_file.txt could not be opened. | 8 File non_existant_file.txt could not be opened. |
| 8 | 9 |
| 9 >>> nonexistentFilename = "nonexistent" | 10 >>> nonexistentFilename = "nonexistent" |
| 10 >>> loadTrajectoriesFromSqlite(nonexistentFilename, 'feature') | 11 >>> loadTrajectoriesFromSqlite(nonexistentFilename, 'feature') |
| 11 DB Error: no such table: positions | |
| 12 DB Error: no such table: velocities | |
| 13 [] | 12 [] |
| 14 >>> from os import remove | |
| 15 >>> remove(nonexistentFilename) | |
| 16 | 13 |
| 17 >>> o1 = MovingObject.generate(2, Point(0.,0.), Point(1.,0.), TimeInterval(0,10)) | 14 >>> o1 = MovingObject.generate(2, Point(0.,0.), Point(1.,0.), TimeInterval(0,10)) |
| 18 >>> o2 = MovingObject.generate(3, Point(1.,1.), Point(-0.5,-0.2), TimeInterval(0,9)) | 15 >>> o2 = MovingObject.generate(3, Point(1.,1.), Point(-0.5,-0.2), TimeInterval(0,9)) |
| 19 >>> saveTrajectoriesToSqlite('test.sqlite', [o1, o2], 'feature') | 16 >>> saveTrajectoriesToSqlite('test.sqlite', [o1, o2], 'feature') |
| 20 >>> objects = loadTrajectoriesFromSqlite('test.sqlite', 'feature') | 17 >>> objects = loadTrajectoriesFromSqlite('test.sqlite', 'feature') |
