This repository has been archived by the owner on Jul 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtests_pipeline_caller.py
62 lines (42 loc) · 1.92 KB
/
tests_pipeline_caller.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
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import re
import subprocess
import sys
import unittest
from pipeline_caller import PipelineCaller, get_token
KATANA = 'Katana\'yı saklarız, dedi Ramiz, ben giderim bahçeye, tüm yeşil erikleri toplar gelirim, sonra da erikleri komşuya götürür, ondan Katana\'yı ele vermemesini isterim.'
KELIME = 'kelime kelime gönderelim bakalım'
UCDORT = ' Üç - dört kız başı göründü . Gülüşüp itişiyorlar . '
class Test(unittest.TestCase):
def module_Vowelizer_word_test(self):
caller = PipelineCaller('Vowelizer', KELIME, get_token(), 'word')
r = re.compile(r'(.+?\n)', re.MULTILINE)
response = caller.call()
print(response)
assert len(re.findall(r, response)) == 4
def module_pipelineNoisy_sentence_test(self):
caller = PipelineCaller('pipelineNoisy', UCDORT, get_token(), 'sentence')
r1 = re.compile(r'(1)(\t.+?){7,}', re.MULTILINE)
r2 = re.compile(r'(5)(\t.+?){7,}', re.MULTILINE)
response = caller.call()
print(response)
assert len(re.findall(r1, response)) == 2 and len(re.findall(r2, response)) == 1
def module_pipelineNoisy_whole_test(self):
caller = PipelineCaller('pipelineNoisy', KATANA, get_token(), 'whole')
r = re.compile(r'(\d+)(\t.+?){7,}', re.MULTILINE)
response = caller.call()
print(response)
assert len(re.findall(r, response)) == 29
def tool_exception_test(self):
exec(open('./pipeline_caller.py').read())
def tool_noisy_test(self):
# subprocess.Popen("python3 pipeline_caller.py katana.txt")
script_path = "./pipeline_caller.py"
subprocess.check_call(
[sys.executable or 'python3', script_path, "test_inputs/katana.txt"],
cwd=os.path.dirname(script_path)
)
if __name__ == '__main__':
unittest.main()