Skip to content
Permalink
Browse files

Add another real test

+ move imports down to see if we can get some more logging
  • Loading branch information...
shankari committed Feb 24, 2018
1 parent b4b578e commit 2d86dd2a71a4c28223a431693992cb4f939c57b1
Showing with 19 additions and 8 deletions.
  1. +19 −8 emission/individual_tests/TestPipeline.py
@@ -18,21 +18,13 @@
# Our imports
import emission.core.get_database as edb
from emission.core.wrapper.user import User
from emission.core.wrapper.client import Client
import emission.core.wrapper.localdate as ecwl
import emission.core.wrapper.location as ecwlo
import emission.core.wrapper.section as ecws
import emission.core.wrapper.entry as ecwe
import emission.core.wrapper.modeprediction as ecwm
import emission.core.wrapper.motionactivity as ecwma

import emission.tests.common as etc
import emission.net.usercache.formatters.common as enufc

import emission.analysis.classification.inference.mode.pipeline as pipeline
import emission.storage.timeseries.abstract_timeseries as esta
import emission.storage.decorations.analysis_timeseries_queries as esda
import emission.storage.decorations.section_queries as esds

'''
TODO:
@@ -41,6 +33,14 @@
'''
class TestPipeline(unittest.TestCase):
def setUp(self):
import emission.tests.common as etc
import emission.net.usercache.formatters.common as enufc

import emission.analysis.classification.inference.mode.pipeline as pipeline
import emission.storage.timeseries.abstract_timeseries as esta
import emission.storage.decorations.analysis_timeseries_queries as esda
import emission.storage.decorations.section_queries as esds

# Thanks to M&J for the number!
np.random.seed(61297777)
self.copied_model_path = etc.copy_dummy_seed_for_inference()
@@ -70,6 +70,13 @@ def clearRelatedDb(self):
edb.get_usercache_db().delete_many({"user_id": self.testUUID})

def testFeatureGenWithOnePoint(self):
import emission.tests.common as etc
import emission.net.usercache.formatters.common as enufc

import emission.analysis.classification.inference.mode.pipeline as pipeline
import emission.storage.timeseries.abstract_timeseries as esta
import emission.storage.decorations.analysis_timeseries_queries as esda
import emission.storage.decorations.section_queries as esds
# ensure that the start and end datetimes are the same, since the average calculation uses
# the total distance and the total duration
ts = esta.TimeSeries.get_time_series(self.testUUID)
@@ -100,6 +107,10 @@ def testFeatureGenWithOnePoint(self):
self.assertEqual(np.count_nonzero(featureMatrix[0][5:16]), 0)
self.assertEqual(np.count_nonzero(featureMatrix[0][19:21]), 0)

def testEntirePipeline(self):
self.pipeline.user_id = self.testUUID
self.pipeline.runPredictionPipeline(self.testUUID, None)

if __name__ == '__main__':
etc.configLogging()
unittest.main()

0 comments on commit 2d86dd2

Please sign in to comment.
You can’t perform that action at this time.