forked from meet59patel/Group3-Yosemite-NLP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_model.py
62 lines (47 loc) · 1.4 KB
/
test_model.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
import pytest
from similarity_v1 import assess_answer
# arr= [("This is a sample test case","This is a sample test case"), ("The world is a beautiful place","Cars are the best")]
small_correct= []
small_error= []
long_correct = []
long_error = []
file1 = open('small_correct.txt', 'r')
file2 = open('small_wrong.txt', 'r')
file3 = open('long_correct.txt', 'r')
file4 = open('long_wrong.txt', 'r')
Lines1 = file1.readlines()
Lines2 = file2.readlines()
Lines3 = file3.readlines()
Lines4 = file4.readlines()
for line in Lines1:
line = line.strip()
a,b = line.split(';')
small_correct.append((a,b))
for line in Lines2:
line = line.strip()
a,b = line.split(';')
small_error.append((a,b))
for line in Lines3:
line = line.strip()
a,b = line.split(';')
long_correct.append((a,b))
for line in Lines4:
line = line.strip()
a,b = line.split(';')
long_error.append((a,b))
@pytest.mark.parametrize("a,b", small_correct)
def test_small_correct(a,b):
assert assess_answer(a,b,5) == 5
@pytest.mark.parametrize("a,b", long_correct)
def test_large_correct(a,b):
assert assess_answer(a,b,10) == 10
@pytest.mark.parametrize("a,b", small_error)
def test_small_correct(a,b):
val = assess_answer(a,b,5)
val = 5 -val
assert val >= 1
@pytest.mark.parametrize("a,b", long_error)
def test_large_correct(a,b):
val = assess_answer(a,b,10)
val = 10 -val
assert val >= 2