57 lines
1.3 KiB
Python
57 lines
1.3 KiB
Python
"""Test of data module.
|
|
|
|
:Date: 2019-07-29
|
|
|
|
.. module:: test_data
|
|
:platform: *nix, Windows
|
|
:synopsis: Test of data module.
|
|
|
|
.. moduleauthor:: Daniel Weschke <daniel.weschke@directbox.de>
|
|
"""
|
|
import unittest
|
|
|
|
import os
|
|
import sys
|
|
sys.path.insert(0, os.path.abspath('../src'))
|
|
from data import read, unique_ending, get_id
|
|
|
|
|
|
class TestData(unittest.TestCase):
|
|
file_name = "test_fit.dat"
|
|
ids = [
|
|
'2f7a762d-98e2-4f4a-ac0d-188b8625fb64',
|
|
'ec54948d-76d4-4717-81cd-db7a15f750cf',
|
|
'837c5378-9e6e-4bd0-b6a7-460d02fb62a3',
|
|
'efa51a89-4dc5-4e96-8c8c-4f0c6461dafa',
|
|
'c04e5303-4ba0-4ff5-acd8-197680b27bda',
|
|
'2994791a-b2e1-47f5-bdbc-3050cf249808',
|
|
'fc12b455-a574-4361-a8cc-1a430e18dfa8',
|
|
'560b34bb-74e7-463e-94da-be3f5e393f13',
|
|
'ba2bdca8-fd2c-48a9-b9b0-3734f33ebe94',
|
|
]
|
|
|
|
def test_read(self):
|
|
"""test read function"""
|
|
x, y = read(self.file_name, 3, 2)
|
|
|
|
self.assertEqual(len(x), 1027)
|
|
self.assertEqual(len(y), 1027)
|
|
|
|
def test_unique_ending(self):
|
|
"""test unique_ending function"""
|
|
self.assertEqual(
|
|
unique_ending(self.ids),
|
|
['64', 'cf', 'a3', 'fa', 'da', '08', 'a8', '13', '94']
|
|
)
|
|
|
|
def test_get_id(self):
|
|
"""test get_id function"""
|
|
self.assertEqual(
|
|
get_id(self.ids, 'a3'),
|
|
'837c5378-9e6e-4bd0-b6a7-460d02fb62a3'
|
|
)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|