forked from wbengine/wblib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
base_test.py
31 lines (26 loc) · 951 Bytes
/
base_test.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
import os
import unittest
import base
testdata = os.path.join(os.path.dirname(__file__), 'testdata')
outdir = base.mkdir('/Users/lls/tmp/wblibTestOutput')
class BaseTest(unittest.TestCase):
def setUp(self):
self.wp_tools_dir = '/Users/lls/tools/subword-nmt'
self.wp_bpe_codes = testdata + '/trans.bpe.codes'
self.wp_vocabulary = testdata + '/vocab.wp'
def test_generate_wp(self):
self.assertEqual(
base.generate_wp(self.wp_tools_dir,
['this is a cat', ''],
self.wp_bpe_codes,
self.wp_vocabulary),
['this is a ca@@ t',
'']
)
self.assertEqual(
base.generate_wp(self.wp_tools_dir,
['', '', ''],
self.wp_bpe_codes,
self.wp_vocabulary),
['', '', '']
)