@@ -36,17 +36,8 @@ class TestAssistedTaggingQuery(GraphQLTestCase):
3636 ENABLE_NOW_PATCHER = True
3737
3838 ASSISTED_TAGGING_NLP_DATA = '''
39- query MyQuery ($taggingModelId: ID!, $predictionTag: ID! ) {
39+ query MyQuery ($taggingModelId: ID! ) {
4040 assistedTagging {
41- predictionTags {
42- id
43- group
44- isCategory
45- isDeprecated
46- hideInAnalysisFrameworkMapping
47- parentTag
48- tagId
49- }
5041 taggingModels {
5142 id
5243 modelId
@@ -65,15 +56,6 @@ class TestAssistedTaggingQuery(GraphQLTestCase):
6556 version
6657 }
6758 }
68- predictionTag(id: $predictionTag) {
69- id
70- group
71- isCategory
72- isDeprecated
73- hideInAnalysisFrameworkMapping
74- parentTag
75- tagId
76- }
7759 }
7860 }
7961 '''
@@ -88,15 +70,6 @@ class TestAssistedTaggingQuery(GraphQLTestCase):
8870 predictionStatus
8971 predictionStatusDisplay
9072 predictionReceivedAt
91- predictionTags {
92- id
93- modelVersion
94- dataType
95- dataTypeDisplay
96- value
97- category
98- tag
99- }
10073 geoAreas {
10174 title
10275 }
@@ -111,14 +84,12 @@ def test_unified_connector_nlp_data(self):
11184
11285 model1 , * other_models = AssistedTaggingModelFactory .create_batch (2 )
11386 AssistedTaggingModelVersionFactory .create_batch (2 , model = model1 )
114- tag1 , * other_tags = AssistedTaggingModelPredictionTagFactory .create_batch (5 )
11587
11688 # -- without login
11789 content = self .query_check (
11890 self .ASSISTED_TAGGING_NLP_DATA ,
11991 variables = dict (
12092 taggingModelId = model1 .id ,
121- predictionTag = tag1 .id ,
12293 ),
12394 assert_for_error = True ,
12495 )
@@ -129,31 +100,8 @@ def test_unified_connector_nlp_data(self):
129100 self .ASSISTED_TAGGING_NLP_DATA ,
130101 variables = dict (
131102 taggingModelId = model1 .id ,
132- predictionTag = tag1 .id ,
133103 )
134104 )['data' ]['assistedTagging' ]
135- self .assertEqual (content ['predictionTags' ], [
136- dict (
137- id = str (tag .id ),
138- tagId = tag .tag_id ,
139- isDeprecated = tag .is_deprecated ,
140- isCategory = tag .is_category ,
141- group = tag .group ,
142- hideInAnalysisFrameworkMapping = tag .hide_in_analysis_framework_mapping ,
143- parentTag = tag .parent_tag_id and str (tag .parent_tag_id ),
144- )
145- for tag in [tag1 , * other_tags ]
146- ])
147- self .assertEqual (content ['predictionTag' ], dict (
148- id = str (tag1 .id ),
149- tagId = tag1 .tag_id ,
150- isDeprecated = tag1 .is_deprecated ,
151- isCategory = tag1 .is_category ,
152- group = tag1 .group ,
153- hideInAnalysisFrameworkMapping = tag1 .hide_in_analysis_framework_mapping ,
154- parentTag = tag1 .parent_tag_id and str (tag1 .parent_tag_id ),
155- ))
156-
157105 self .assertEqual (content ['taggingModels' ], [
158106 dict (
159107 id = str (_model .id ),
@@ -196,38 +144,8 @@ def test_unified_connector_draft_entry(self):
196144 GeoAreaFactory .create (admin_level = admin_level , title = 'Nepal' )
197145 GeoAreaFactory .create (admin_level = admin_level , title = 'Bagmati' )
198146 GeoAreaFactory .create (admin_level = admin_level , title = 'Kathmandu' )
199- model1 = AssistedTaggingModelFactory .create ()
200- geo_model = AssistedTaggingModelFactory .create (model_id = AssistedTaggingModel .ModelID .GEO )
201- latest_model1_version = AssistedTaggingModelVersionFactory .create_batch (2 , model = model1 )[0 ]
202- latest_geo_model_version = AssistedTaggingModelVersionFactory .create (model = geo_model )
203- category1 , tag1 , * other_tags = AssistedTaggingModelPredictionTagFactory .create_batch (5 )
204-
205147 draft_entry1 = DraftEntryFactory .create (project = project , lead = lead , excerpt = 'sample excerpt' )
206148
207- prediction1 = AssistedTaggingPredictionFactory .create (
208- data_type = AssistedTaggingPrediction .DataType .TAG ,
209- model_version = latest_model1_version ,
210- draft_entry = draft_entry1 ,
211- category = category1 ,
212- tag = tag1 ,
213- prediction = 0.1 ,
214- threshold = 0.05 ,
215- is_selected = True ,
216- )
217- prediction2 = AssistedTaggingPredictionFactory .create (
218- data_type = AssistedTaggingPrediction .DataType .RAW ,
219- model_version = latest_geo_model_version ,
220- draft_entry = draft_entry1 ,
221- value = 'Nepal' ,
222- is_selected = True ,
223- )
224- prediction3 = AssistedTaggingPredictionFactory .create (
225- data_type = AssistedTaggingPrediction .DataType .RAW ,
226- model_version = latest_geo_model_version ,
227- draft_entry = draft_entry1 ,
228- value = 'Kathmandu' ,
229- is_selected = True ,
230- )
231149 draft_entry1 .save_geo_data ()
232150
233151 def _query_check (** kwargs ):
@@ -257,44 +175,7 @@ def _query_check(**kwargs):
257175 predictionReceivedAt = None ,
258176 predictionStatus = self .genum (draft_entry1 .prediction_status ),
259177 predictionStatusDisplay = draft_entry1 .get_prediction_status_display (),
260- predictionTags = [
261- dict (
262- id = str (prediction1 .pk ),
263- modelVersion = str (prediction1 .model_version_id ),
264- dataType = self .genum (prediction1 .data_type ),
265- dataTypeDisplay = prediction1 .get_data_type_display (),
266- value = '' ,
267- category = str (prediction1 .category_id ),
268- tag = str (prediction1 .tag_id ),
269- ),
270- dict (
271- id = str (prediction2 .id ),
272- modelVersion = str (prediction2 .model_version .id ),
273- dataType = self .genum (prediction2 .data_type ),
274- dataTypeDisplay = prediction2 .get_data_type_display (),
275- value = prediction2 .value ,
276- category = None ,
277- tag = None ,
278- ),
279- dict (
280- id = str (prediction3 .id ),
281- modelVersion = str (prediction3 .model_version .id ),
282- dataType = self .genum (prediction3 .data_type ),
283- dataTypeDisplay = prediction3 .get_data_type_display (),
284- value = prediction3 .value ,
285- category = None ,
286- tag = None ,
287- )
288- ],
289- geoAreas = [
290- dict (
291- title = 'Nepal' ,
292- ),
293- dict (
294- title = 'Kathmandu' ,
295- )
296-
297- ],
178+ geoAreas = []
298179 ))
299180
300181
0 commit comments