def test_get_platform_variable_track(self):
        p = self.session.query(Platform).filter_by(id=1).first()
        results = q.get_platform_variable_track(db.session(),
                                                p,
                                                "sst",
                                                quantum="day")
        self.assertEqual(len(results), 5)
        self.assertAlmostEqual(results[0][0], 59.68256664277501)
        results = q.get_platform_variable_track(db.session(),
                                                p,
                                                "sst",
                                                quantum="year")
        self.assertEqual(len(results), 1)

        results = q.get_platform_variable_track(
            db.session(),
            p,
            "sst",
            quantum="hour",
            starttime=datetime.datetime(2018,
                                        2,
                                        6,
                                        14,
                                        31,
                                        36,
                                        tzinfo=datetime.timezone.utc),
        )
        self.assertEqual(len(results), 3)
예제 #2
0
 def setUp(self):
     self.session = db.session()