-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathtest_data_points.py
66 lines (47 loc) · 2.01 KB
/
test_data_points.py
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import unittest
from os.path import join
from praatio import data_points
from tests.testing_utils import areTheSameFiles
from tests.praatio_test_case import PraatioTestCase
class TestDataPoint(PraatioTestCase):
def test_duration_tier_io(self):
"""Tests for reading/writing duration tiers"""
fn = "mary.DurationTier"
inputFN = join(self.dataRoot, fn)
outputFN = join(self.outputRoot, fn)
dt = data_points.open2DPointObject(inputFN)
dt.save(outputFN)
self.assertTrue(
areTheSameFiles(inputFN, outputFN, data_points.open2DPointObject)
)
def test_pitch_io(self):
"""Tests for reading/writing pitch tiers"""
fn = "mary.PitchTier"
inputFN = join(self.dataRoot, fn)
outputFN = join(self.outputRoot, fn)
pp = data_points.open2DPointObject(inputFN)
pp.save(outputFN)
self.assertTrue(
areTheSameFiles(inputFN, outputFN, data_points.open2DPointObject)
)
def test_pitch_io_long_vs_short(self):
"""Tests reading of long vs short 2d point objects"""
shortFN = join(self.dataRoot, "mary.PitchTier")
longFN = join(self.dataRoot, "mary_longfile.PitchTier")
self.assertTrue(areTheSameFiles(shortFN, longFN, data_points.open2DPointObject))
def test_point_process_io(self):
"""Tests for reading/writing point processes"""
fn = "bobby.PointProcess"
inputFN = join(self.dataRoot, fn)
outputFN = join(self.outputRoot, fn)
pp = data_points.open1DPointObject(inputFN)
pp.save(outputFN)
self.assertTrue(
areTheSameFiles(inputFN, outputFN, data_points.open1DPointObject)
)
def test_point_process_io_long_vs_short(self):
shortFN = join(self.dataRoot, "bobby.PointProcess")
longFN = join(self.dataRoot, "bobby_longfile.PointProcess")
self.assertTrue(areTheSameFiles(shortFN, longFN, data_points.open1DPointObject))
if __name__ == "__main__":
unittest.main()