aboutsummaryrefslogtreecommitdiff
path: root/src/argaze.test/DataLog/File.py
blob: 2d66ea62b5953769120710e5d59a70bafe986eef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python

""" """

__author__ = "Théo de la Hogue"
__credits__ = []
__copyright__ = "Copyright 2023, Ecole Nationale de l'Aviation Civile (ENAC)"
__license__ = "BSD"

import unittest
import os

from argaze import DataFeatures
from argaze.DataLog import File
from argaze.utils import UtilsFeatures

DataFeaturesTest = UtilsFeatures.importFromTestPackage('DataFeatures')

class TestTimeStampedDataLogger(unittest.TestCase):
    """Test DataLogger class."""

    def test_creation(self):
        """Test logger creation."""

        file_logger = File.TimeStampedDataLogger(path='./_export/logs/data.txt', separator=',')
        
        # Check file creation
        self.assertEqual(os.path.exists('./_export/logs/data.txt'), True)

        # Write into file
        file_logger.emit(0, 'A')
        file_logger.emit(1, 'B')
        file_logger.emit(2, 'C')

if __name__ == '__main__':

    unittest.main()