Exemplo n.º 1
0
class TestLogParserMissingMeta(unittest.TestCase):

    def setUp(self):
        self.parser = LogParser()

    def test_MissingFields(self):
        log = MockFile().without('Fields')
        self.assertRaises(MissingFieldException, self.parser.parse, log)

    def test_MissingDate(self):
        log = MockFile().without('Date')
        # this should raise no exception
        self.parser.parse(log)
Exemplo n.º 2
0
class TestLogParser(unittest.TestCase):

    def setUp(self):
        self.parser = LogParser()
        self.log = MockFile()
        self.output = self.parser.parse(self.log)

    def test_Fields(self):
        expected = ['Brick Temperature', 'Oven Temperature', 'Chimney Temperature']
        actual = self.parser.meta['fields']
        self.assertEqual(expected, actual)

    def test_Date(self):
        expected = 1346960794000
        actual = self.output['data_date']
        self.assertEqual(expected, actual)

    def test_Series(self):
        expected = [
            {'data': [[1346960794000, 20.0], [1346960809000, 22.1], [1346960824000, 24.4]], 'label': 'Brick Temperature'},
            {'data': [[1346960794000, 40.0], [1346960809000, 45.8], [1346960824000, 53.1]], 'label': 'Oven Temperature'},
            {'data': [[1346960794000, 31.3], [1346960809000, 40.8], [1346960824000, 49.7]], 'label': 'Chimney Temperature'}
        ]
        actual = self.output['data']
        self.assertEqual(expected, actual)
Exemplo n.º 3
0
 def setUp(self):
     self.parser = LogParser()
Exemplo n.º 4
0
 def setUp(self):
     self.parser = LogParser()
     self.log = MockFile()
     self.output = self.parser.parse(self.log)