Skip to content

Commit 8734ba0

Browse files
[formrecognizer] Re-name variables in tests (#21916)
Fixes #20848 NOTE: this is renaming vars in the old tests, in subsequent PRs these tests will be reorganized into new files and names may be changed more.
1 parent 8d4f389 commit 8734ba0

File tree

4 files changed

+48
-48
lines changed

4 files changed

+48
-48
lines changed

sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -216,23 +216,23 @@ def callback(raw_response, _, headers):
216216
@FormRecognizerPreparer()
217217
@DocumentModelAdministrationClientPreparer()
218218
def test_custom_document_transform(self, client, formrecognizer_storage_container_sas_url):
219-
fr_client = client.get_document_analysis_client()
219+
da_client = client.get_document_analysis_client()
220220

221221
poller = client.begin_build_model(formrecognizer_storage_container_sas_url)
222222
model = poller.result()
223223

224224
responses = []
225225

226226
def callback(raw_response, _, headers):
227-
analyze_result = fr_client._deserialize(AnalyzeResultOperation, raw_response)
227+
analyze_result = da_client._deserialize(AnalyzeResultOperation, raw_response)
228228
document = AnalyzeResult._from_generated(analyze_result.analyze_result)
229229
responses.append(analyze_result)
230230
responses.append(document)
231231

232232
with open(self.form_jpg, "rb") as fd:
233233
myfile = fd.read()
234234

235-
poller = fr_client.begin_analyze_document(
235+
poller = da_client.begin_analyze_document(
236236
model.model_id,
237237
myfile,
238238
cls=callback
@@ -260,23 +260,23 @@ def callback(raw_response, _, headers):
260260
@FormRecognizerPreparer()
261261
@DocumentModelAdministrationClientPreparer()
262262
def test_custom_document_multipage_transform(self, client, formrecognizer_multipage_storage_container_sas_url):
263-
fr_client = client.get_document_analysis_client()
263+
da_client = client.get_document_analysis_client()
264264

265265
poller = client.begin_build_model(formrecognizer_multipage_storage_container_sas_url)
266266
model = poller.result()
267267

268268
responses = []
269269

270270
def callback(raw_response, _, headers):
271-
analyze_result = fr_client._deserialize(AnalyzeResultOperation, raw_response)
271+
analyze_result = da_client._deserialize(AnalyzeResultOperation, raw_response)
272272
document = AnalyzeResult._from_generated(analyze_result.analyze_result)
273273
responses.append(analyze_result)
274274
responses.append(document)
275275

276276
with open(self.multipage_invoice_pdf, "rb") as fd:
277277
myfile = fd.read()
278278

279-
poller = fr_client.begin_analyze_document(
279+
poller = da_client.begin_analyze_document(
280280
model.model_id,
281281
myfile,
282282
cls=callback
@@ -409,7 +409,7 @@ def callback(raw_response, _, headers):
409409
@FormRecognizerPreparer()
410410
@DocumentModelAdministrationClientPreparer()
411411
def test_custom_document_selection_mark(self, client, formrecognizer_selection_mark_storage_container_sas_url):
412-
fr_client = client.get_document_analysis_client()
412+
da_client = client.get_document_analysis_client()
413413

414414
poller = client.begin_build_model(formrecognizer_selection_mark_storage_container_sas_url)
415415
model = poller.result()
@@ -420,12 +420,12 @@ def test_custom_document_selection_mark(self, client, formrecognizer_selection_m
420420
responses = []
421421

422422
def callback(raw_response, _, headers):
423-
analyze_result = fr_client._deserialize(AnalyzeResultOperation, raw_response)
423+
analyze_result = da_client._deserialize(AnalyzeResultOperation, raw_response)
424424
document = AnalyzeResult._from_generated(analyze_result.analyze_result)
425425
responses.append(analyze_result)
426426
responses.append(document)
427427

428-
poller = fr_client.begin_analyze_document(
428+
poller = da_client.begin_analyze_document(
429429
model.model_id,
430430
myfile,
431431
cls=callback
@@ -453,15 +453,15 @@ def callback(raw_response, _, headers):
453453
@FormRecognizerPreparer()
454454
@DocumentModelAdministrationClientPreparer()
455455
def test_pages_kwarg_specified(self, client, formrecognizer_storage_container_sas_url):
456-
fr_client = client.get_document_analysis_client()
456+
da_client = client.get_document_analysis_client()
457457

458458
with open(self.form_jpg, "rb") as fd:
459459
myfile = fd.read()
460460

461461
build_poller = client.begin_build_model(formrecognizer_storage_container_sas_url)
462462
model = build_poller.result()
463463

464-
poller = fr_client.begin_analyze_document(model.model_id, myfile, pages="1")
464+
poller = da_client.begin_analyze_document(model.model_id, myfile, pages="1")
465465
assert '1' == poller._polling_method._initial_response.http_response.request.query['pages']
466466
result = poller.result()
467467
assert result
@@ -470,15 +470,15 @@ def test_pages_kwarg_specified(self, client, formrecognizer_storage_container_sa
470470
@FormRecognizerPreparer()
471471
@DocumentModelAdministrationClientPreparer()
472472
def test_custom_document_signature_field(self, client, formrecognizer_storage_container_sas_url):
473-
fr_client = client.get_document_analysis_client()
473+
da_client = client.get_document_analysis_client()
474474

475475
with open(self.form_jpg, "rb") as fd:
476476
myfile = fd.read()
477477

478478
build_polling = client.begin_build_model(formrecognizer_storage_container_sas_url)
479479
model = build_polling.result()
480480

481-
poller = fr_client.begin_analyze_document(
481+
poller = da_client.begin_analyze_document(
482482
model.model_id,
483483
myfile,
484484
)

sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_async.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@ def callback(raw_response, _, headers):
152152
@FormRecognizerPreparer()
153153
@DocumentModelAdministrationClientPreparer()
154154
async def test_custom_document_transform(self, client, formrecognizer_storage_container_sas_url):
155-
fr_client = client.get_document_analysis_client()
155+
da_client = client.get_document_analysis_client()
156156

157157
responses = []
158158

159159
def callback(raw_response, _, headers):
160-
analyze_result = fr_client._deserialize(AnalyzeResultOperation, raw_response)
160+
analyze_result = da_client._deserialize(AnalyzeResultOperation, raw_response)
161161
document = AnalyzeResult._from_generated(analyze_result.analyze_result)
162162
responses.append(analyze_result)
163163
responses.append(document)
@@ -169,8 +169,8 @@ def callback(raw_response, _, headers):
169169
build_polling = await client.begin_build_model(formrecognizer_storage_container_sas_url)
170170
model = await build_polling.result()
171171

172-
async with fr_client:
173-
poller = await fr_client.begin_analyze_document(
172+
async with da_client:
173+
poller = await da_client.begin_analyze_document(
174174
model.model_id,
175175
myfile,
176176
cls=callback
@@ -198,12 +198,12 @@ def callback(raw_response, _, headers):
198198
@FormRecognizerPreparer()
199199
@DocumentModelAdministrationClientPreparer()
200200
async def test_custom_document_multipage_transform(self, client, formrecognizer_multipage_storage_container_sas_url):
201-
fr_client = client.get_document_analysis_client()
201+
da_client = client.get_document_analysis_client()
202202

203203
responses = []
204204

205205
def callback(raw_response, _, headers):
206-
analyze_result = fr_client._deserialize(AnalyzeResultOperation, raw_response)
206+
analyze_result = da_client._deserialize(AnalyzeResultOperation, raw_response)
207207
document = AnalyzeResult._from_generated(analyze_result.analyze_result)
208208
responses.append(analyze_result)
209209
responses.append(document)
@@ -215,8 +215,8 @@ def callback(raw_response, _, headers):
215215
build_poller = await client.begin_build_model(formrecognizer_multipage_storage_container_sas_url)
216216
model = await build_poller.result()
217217

218-
async with fr_client:
219-
poller = await fr_client.begin_analyze_document(
218+
async with da_client:
219+
poller = await da_client.begin_analyze_document(
220220
model.model_id,
221221
myfile,
222222
cls=callback
@@ -356,14 +356,14 @@ def callback(raw_response, _, headers):
356356
@FormRecognizerPreparer()
357357
@DocumentModelAdministrationClientPreparer()
358358
async def test_custom_document_selection_mark(self, client, formrecognizer_selection_mark_storage_container_sas_url):
359-
fr_client = client.get_document_analysis_client()
359+
da_client = client.get_document_analysis_client()
360360
with open(self.selection_form_pdf, "rb") as fd:
361361
myfile = fd.read()
362362

363363
responses = []
364364

365365
def callback(raw_response, _, headers):
366-
analyze_result = fr_client._deserialize(AnalyzeResultOperation, raw_response)
366+
analyze_result = da_client._deserialize(AnalyzeResultOperation, raw_response)
367367
document = AnalyzeResult._from_generated(analyze_result.analyze_result)
368368
responses.append(analyze_result)
369369
responses.append(document)
@@ -372,7 +372,7 @@ def callback(raw_response, _, headers):
372372
poller = await client.begin_build_model(formrecognizer_selection_mark_storage_container_sas_url)
373373
model = await poller.result()
374374

375-
poller = await fr_client.begin_analyze_document(
375+
poller = await da_client.begin_analyze_document(
376376
model.model_id,
377377
myfile,
378378
cls=callback
@@ -400,7 +400,7 @@ def callback(raw_response, _, headers):
400400
@FormRecognizerPreparer()
401401
@DocumentModelAdministrationClientPreparer()
402402
async def test_pages_kwarg_specified(self, client, formrecognizer_storage_container_sas_url):
403-
fr_client = client.get_document_analysis_client()
403+
da_client = client.get_document_analysis_client()
404404

405405
with open(self.form_jpg, "rb") as fd:
406406
myfile = fd.read()
@@ -409,16 +409,16 @@ async def test_pages_kwarg_specified(self, client, formrecognizer_storage_contai
409409
build_poller = await client.begin_build_model(formrecognizer_storage_container_sas_url)
410410
model = await build_poller.result()
411411

412-
async with fr_client:
413-
poller = await fr_client.begin_analyze_document(model.model_id, myfile, pages="1")
412+
async with da_client:
413+
poller = await da_client.begin_analyze_document(model.model_id, myfile, pages="1")
414414
assert '1' == poller._polling_method._initial_response.http_response.request.query['pages']
415415
result = await poller.result()
416416
assert result
417417

418418
@FormRecognizerPreparer()
419419
@DocumentModelAdministrationClientPreparer()
420420
async def test_custom_document_signature_field(self, client, formrecognizer_storage_container_sas_url):
421-
fr_client = client.get_document_analysis_client()
421+
da_client = client.get_document_analysis_client()
422422

423423
with open(self.form_jpg, "rb") as fd:
424424
myfile = fd.read()
@@ -427,8 +427,8 @@ async def test_custom_document_signature_field(self, client, formrecognizer_stor
427427
build_polling = await client.begin_build_model(formrecognizer_storage_container_sas_url)
428428
model = await build_polling.result()
429429

430-
async with fr_client:
431-
poller = await fr_client.begin_analyze_document(
430+
async with da_client:
431+
poller = await da_client.begin_analyze_document(
432432
model.model_id,
433433
myfile,
434434
)

sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -254,20 +254,20 @@ def callback(raw_response, _, headers):
254254
@FormRecognizerPreparer()
255255
@DocumentModelAdministrationClientPreparer()
256256
def test_custom_document_selection_mark(self, client, formrecognizer_selection_mark_storage_container_sas_url):
257-
fr_client = client.get_document_analysis_client()
257+
da_client = client.get_document_analysis_client()
258258

259259
poller = client.begin_build_model(formrecognizer_selection_mark_storage_container_sas_url)
260260
model = poller.result()
261261

262262
responses = []
263263

264264
def callback(raw_response, _, headers):
265-
analyze_result = fr_client._deserialize(AnalyzeResultOperation, raw_response)
265+
analyze_result = da_client._deserialize(AnalyzeResultOperation, raw_response)
266266
document = AnalyzeResult._from_generated(analyze_result.analyze_result)
267267
responses.append(analyze_result)
268268
responses.append(document)
269269

270-
poller = fr_client.begin_analyze_document_from_url(
270+
poller = da_client.begin_analyze_document_from_url(
271271
model=model.model_id,
272272
document_url=self.selection_mark_url_pdf,
273273
cls=callback
@@ -309,20 +309,20 @@ def test_pages_kwarg_specified(self, client, formrecognizer_testing_data_contain
309309
@FormRecognizerPreparer()
310310
@DocumentModelAdministrationClientPreparer()
311311
def test_label_tables_variable_rows(self, client, formrecognizer_table_variable_rows_container_sas_url):
312-
fr_client = client.get_document_analysis_client()
312+
da_client = client.get_document_analysis_client()
313313

314314
build_poller = client.begin_build_model(formrecognizer_table_variable_rows_container_sas_url)
315315
model = build_poller.result()
316316

317317
responses = []
318318

319319
def callback(raw_response, _, headers):
320-
analyze_result = fr_client._deserialize(AnalyzeResultOperation, raw_response)
320+
analyze_result = da_client._deserialize(AnalyzeResultOperation, raw_response)
321321
document = AnalyzeResult._from_generated(analyze_result.analyze_result)
322322
responses.append(analyze_result)
323323
responses.append(document)
324324

325-
poller = fr_client.begin_analyze_document_from_url(
325+
poller = da_client.begin_analyze_document_from_url(
326326
model.model_id,
327327
self.label_table_variable_row_url_pdf,
328328
cls=callback
@@ -349,20 +349,20 @@ def callback(raw_response, _, headers):
349349
@FormRecognizerPreparer()
350350
@DocumentModelAdministrationClientPreparer()
351351
def test_label_tables_fixed_rows(self, client, formrecognizer_table_fixed_rows_container_sas_url):
352-
fr_client = client.get_document_analysis_client()
352+
da_client = client.get_document_analysis_client()
353353

354354
build_poller = client.begin_build_model(formrecognizer_table_fixed_rows_container_sas_url)
355355
model = build_poller.result()
356356

357357
responses = []
358358

359359
def callback(raw_response, _, headers):
360-
analyze_result = fr_client._deserialize(AnalyzeResultOperation, raw_response)
360+
analyze_result = da_client._deserialize(AnalyzeResultOperation, raw_response)
361361
document = AnalyzeResult._from_generated(analyze_result.analyze_result)
362362
responses.append(analyze_result)
363363
responses.append(document)
364364

365-
poller = fr_client.begin_analyze_document_from_url(
365+
poller = da_client.begin_analyze_document_from_url(
366366
model.model_id,
367367
self.label_table_fixed_row_url_pdf,
368368
cls=callback

sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url_async.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,12 @@ def callback(raw_response, _, headers):
268268
@FormRecognizerPreparer()
269269
@DocumentModelAdministrationClientPreparer()
270270
async def test_custom_document_selection_mark(self, client, formrecognizer_selection_mark_storage_container_sas_url):
271-
fr_client = client.get_document_analysis_client()
271+
da_client = client.get_document_analysis_client()
272272

273273
responses = []
274274

275275
def callback(raw_response, _, headers):
276-
analyze_result = fr_client._deserialize(AnalyzeResultOperation, raw_response)
276+
analyze_result = da_client._deserialize(AnalyzeResultOperation, raw_response)
277277
document = AnalyzeResult._from_generated(analyze_result.analyze_result)
278278
responses.append(analyze_result)
279279
responses.append(document)
@@ -284,7 +284,7 @@ def callback(raw_response, _, headers):
284284

285285

286286

287-
poller = await fr_client.begin_analyze_document_from_url(
287+
poller = await da_client.begin_analyze_document_from_url(
288288
model=model.model_id,
289289
document_url=self.selection_mark_url_pdf,
290290
cls=callback
@@ -330,12 +330,12 @@ async def test_pages_kwarg_specified(self, client, formrecognizer_testing_data_c
330330
@FormRecognizerPreparer()
331331
@DocumentModelAdministrationClientPreparer()
332332
async def test_label_tables_variable_rows(self, client, formrecognizer_table_variable_rows_container_sas_url):
333-
fr_client = client.get_document_analysis_client()
333+
da_client = client.get_document_analysis_client()
334334

335335
responses = []
336336

337337
def callback(raw_response, _, headers):
338-
analyze_result = fr_client._deserialize(AnalyzeResultOperation, raw_response)
338+
analyze_result = da_client._deserialize(AnalyzeResultOperation, raw_response)
339339
document = AnalyzeResult._from_generated(analyze_result.analyze_result)
340340
responses.append(analyze_result)
341341
responses.append(document)
@@ -345,7 +345,7 @@ def callback(raw_response, _, headers):
345345
formrecognizer_table_variable_rows_container_sas_url)
346346
model = await build_poller.result()
347347

348-
poller = await fr_client.begin_analyze_document_from_url(
348+
poller = await da_client.begin_analyze_document_from_url(
349349
model.model_id,
350350
self.label_table_variable_row_url_pdf,
351351
cls=callback
@@ -373,12 +373,12 @@ def callback(raw_response, _, headers):
373373
@FormRecognizerPreparer()
374374
@DocumentModelAdministrationClientPreparer()
375375
async def test_label_tables_fixed_rows(self, client, formrecognizer_table_fixed_rows_container_sas_url):
376-
fr_client = client.get_document_analysis_client()
376+
da_client = client.get_document_analysis_client()
377377

378378
responses = []
379379

380380
def callback(raw_response, _, headers):
381-
analyze_result = fr_client._deserialize(AnalyzeResultOperation, raw_response)
381+
analyze_result = da_client._deserialize(AnalyzeResultOperation, raw_response)
382382
document = AnalyzeResult._from_generated(analyze_result.analyze_result)
383383
responses.append(analyze_result)
384384
responses.append(document)
@@ -387,7 +387,7 @@ def callback(raw_response, _, headers):
387387
build_poller = await client.begin_build_model(formrecognizer_table_fixed_rows_container_sas_url)
388388
model = await build_poller.result()
389389

390-
poller = await fr_client.begin_analyze_document_from_url(
390+
poller = await da_client.begin_analyze_document_from_url(
391391
model.model_id,
392392
self.label_table_fixed_row_url_pdf,
393393
cls=callback

0 commit comments

Comments
 (0)