MCPcopy Index your code
hub / github.com/DeepL/deepl-python / test_usage_team_document_limit

Function test_usage_team_document_limit

tests/test_general.py:314–341  ·  view source on GitHub ↗
(
    translator_with_random_auth_key, server, tmpdir
)

Source from the content-addressed store, hash-verified

312
313@needs_mock_server
314def test_usage_team_document_limit(
315 translator_with_random_auth_key, server, tmpdir
316):
317 team_document_limit = 1
318 server.init_character_limit(0)
319 server.init_document_limit(0)
320 server.init_team_document_limit(team_document_limit)
321
322 translator = translator_with_random_auth_key
323 usage = translator.get_usage()
324 assert not usage.any_limit_reached
325 assert "Characters" not in str(usage)
326 assert "Documents" not in str(usage)
327 assert "Team documents: 0 of 1" in str(usage)
328
329 tmpdir = pathlib.Path(tmpdir)
330 input_path = tmpdir / "example_document.txt"
331 input_path.write_text("a")
332 output_path = tmpdir / "example_document_output.txt"
333 translator.translate_document_from_filepath(
334 input_path, output_path, target_lang="DE"
335 )
336
337 usage = translator.get_usage()
338 assert usage.any_limit_reached
339 assert not usage.document.limit_reached
340 assert not usage.character.limit_reached
341 assert usage.team_document.limit_reached
342
343
344def _build_test_response():

Callers

nothing calls this directly

Calls 5

init_character_limitMethod · 0.80
init_document_limitMethod · 0.80
get_usageMethod · 0.80

Tested by

no test coverage detected