File: test_s3gaucnt.py

package info (click to toggle)
sphinxtrain 5.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 32,572 kB
  • sloc: ansic: 94,052; perl: 8,939; python: 6,702; cpp: 2,044; makefile: 6
file content (38 lines) | stat: -rw-r--r-- 1,492 bytes parent folder | download
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
#!/usr/bin/env python

import unittest
from cmusphinx import s3gaucnt, s3mixw
import os


class TestS3GauCnt(unittest.TestCase):
    def setUp(self):
        thisdir = os.path.dirname(__file__)
        self.testdir = os.path.join(thisdir, 'data', 'bwaccumdir')

    def test_read_dirs(self):
        gauden_all = s3gaucnt.accumdirs([os.path.join(self.testdir, d)
                                         for d in os.listdir(self.testdir)])
        gauden1 = s3gaucnt.open(os.path.join(self.testdir,
                                             "an4_buff_1",
                                             "gauden_counts"),
                                "rb")
        gauden2 = s3gaucnt.open(os.path.join(self.testdir,
                                             "an4_buff_2",
                                             "gauden_counts"),
                                "rb")
        self.assertEqual(gauden_all.mean[0][0][0, 0],
                         gauden1.mean[0][0][0, 0]
                         + gauden2.mean[0][0][0, 0])

    def test_read_mixw(self):
        gauden_all = s3gaucnt.accumdirs([os.path.join(self.testdir, d)
                                         for d in os.listdir(self.testdir)])
        mixw = s3mixw.accumdirs([os.path.join(self.testdir, d)
                                 for d in os.listdir(self.testdir)])
        self.assertEqual(gauden_all.dnom[0][0],
                         mixw.getall()[0][0, 0])


if __name__ == '__main__':
    unittest.main()