Ejemplo n.º 1
0
                          len(create_entries.get_data_entries))
        
        for entry in entries:
            res_tsp = int(entry[0])
            self.assertTrue(res_tsp in expected)
            self.assertEquals(entry[1], expected[res_tsp][0])
            self.assertEquals(entry[2], expected[res_tsp][1])

    def test_get_calculated_entries(self):
        entry = {'temp_Vl': 18.0,
                 'temp_Vl': 18.0,
                 'temp_Rl': 14.4,
                 'temp_WQein': 12.5,
                 'temp_WQaus': 10.0,
                 }
        self._add_one(entry)

        expected = 18.0 * 0.06 + 0.5
        result = get_data.PulledData.get_latest(self.session, ['currKW', ])
        self.assertEquals(result[0], expected)

        expected = 18.0 - 14.4
        result = get_data.PulledData.get_latest(self.session, ['deltaVlRl', ])
        self.assertEquals(result[0], expected)

        expected = 12.5 - 10.0
        result = get_data.PulledData.get_latest(self.session, ['deltaWQea', ])
        self.assertEquals(result[0], expected)

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