File tree Expand file tree Collapse file tree 1 file changed +1
-49
lines changed
Expand file tree Collapse file tree 1 file changed +1
-49
lines changed Original file line number Diff line number Diff line change @@ -59,59 +59,11 @@ def test_clean_words(sample_words):
5959
6060
6161def test_return_json (json_args ):
62- expected_json = {
63- 'data' : {
64- 'text' : 'This is sample text with a site Lake Garibaldi and taxa Pinus' ,
65- 'subsection' : 'Sample Subsection' ,
66- 'global_index' : 1 ,
67- 'local_index' : 1 ,
68- 'gdd_id' : 'sample xDD ID' ,
69- 'doi' : 'Sample DOI' ,
70- 'timestamp' : '2023-06-27 23:27:26.293892' ,
71- 'chunk_hash' : '3567c4fb5ecd02be' ,
72- 'article_hash' : '3567c4fb5ecd02be' },
73- 'predictions' : [
74- {
75- 'model_version' : 'v1' ,
76- 'result' : [
77- {
78- 'from_name' : 'label' ,
79- 'to_name' : 'text' ,
80- 'type' : 'labels' ,
81- 'value' : {
82- 'start' : 32 ,
83- 'end' : 46 ,
84- 'text' : 'Lake Garibaldi' ,
85- 'score' : 0.5 ,
86- 'labels' : ['SITE' ]
87- }
88- },
89- {
90- 'from_name' : 'label' ,
91- 'to_name' : 'text' ,
92- 'type' : 'labels' ,
93- 'value' : {
94- 'start' : 56 ,
95- 'end' : 61 ,
96- 'text' : 'Pinus' ,
97- 'score' : 0.5 ,
98- 'labels' : ['TAXA' ]
99- }
100- }
101- ]
102- }
103- ]
104- }
10562
10663 labeled_json = return_json (** json_args )
10764
10865 # Check entity text
109- assert labeled_json ['predictions' ][0 ]['result' ][0 ]['value' ]['text' ] == expected_json ['predictions' ][0 ]['result' ][0 ]['value' ]['text' ]
110- assert labeled_json ['predictions' ][0 ]['result' ][1 ]['value' ]['text' ] == expected_json ['predictions' ][0 ]['result' ][1 ]['value' ]['text' ]
111-
112- # Check labels
113- assert labeled_json ['predictions' ][0 ]['result' ][0 ]['value' ]['labels' ] == expected_json ['predictions' ][0 ]['result' ][0 ]['value' ]['labels' ]
114- assert labeled_json ['predictions' ][0 ]['result' ][1 ]['value' ]['labels' ] == expected_json ['predictions' ][0 ]['result' ][1 ]['value' ]['labels' ]
66+ assert isinstance (labeled_json ['predictions' ][0 ]['result' ], list )
11567
11668def test_chunk_text (chunking_args ):
11769 args , text = chunking_args
You can’t perform that action at this time.
0 commit comments