add unique id ending function and get full id function
and write ascii data file function
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"""Test of data module.
|
||||
|
||||
:Date: 2019-06-12
|
||||
:Date: 2019-07-29
|
||||
|
||||
.. module:: test_data
|
||||
:platform: *nix, Windows
|
||||
@@ -13,19 +13,44 @@ import unittest
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.abspath('../src'))
|
||||
from data import data_read
|
||||
from data import read, unique_ending, get_id
|
||||
|
||||
|
||||
class TestFit(unittest.TestCase):
|
||||
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"""
|
||||
file_name = "test_fit.dat"
|
||||
x, y = data_read(file_name, 3, 2)
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user