hackerrank 2026.11.2__tar.gz → 2026.11.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/PKG-INFO +4 -5
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/README.rst +3 -4
- hackerrank-2026.11.3.1/docs/source/changelog/2026.11.03.1.md +7 -0
- hackerrank-2026.11.3.1/docs/source/changelog/2026.11.03.md +6 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/prek.toml +0 -2
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/pyproject.toml +2 -2
- hackerrank-2026.11.3.1/src/hackerrank/_internal_notes.py +32 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank/async_client.py +14 -21
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank/client.py +14 -21
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank.egg-info/PKG-INFO +4 -5
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank.egg-info/SOURCES.txt +2 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank.egg-info/scm_file_list.json +2 -0
- hackerrank-2026.11.3.1/src/hackerrank.egg-info/scm_version.json +8 -0
- hackerrank-2026.11.3.1/tests/test_internal_notes.py +157 -0
- hackerrank-2026.11.2/src/hackerrank/_internal_notes.py +0 -71
- hackerrank-2026.11.2/src/hackerrank.egg-info/scm_version.json +0 -8
- hackerrank-2026.11.2/tests/test_internal_notes.py +0 -211
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/.git_archival.txt +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/.gitattributes +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/.github/dependabot.yml +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/.github/workflows/autofix.yml +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/.github/workflows/ci.yml +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/.github/workflows/dependabot-merge.yml +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/.github/workflows/lint.yml +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/.github/workflows/publish-site.yml +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/.github/workflows/release.yml +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/.gitignore +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/.prettierrc +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/.vale.ini +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/CHANGELOG.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/LICENSE +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/conftest.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/__init__.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/api-reference.rst +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/changelog/2026.05.12.1.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/changelog/2026.05.12.2.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/changelog/2026.05.12.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/changelog/2026.07.08.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/changelog/2026.07.19.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/changelog/2026.07.30.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/changelog/2026.08.16.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/changelog/2026.08.22.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/changelog/2026.08.27.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/changelog/2026.08.28.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/changelog/2026.09.07.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/changelog/2026.09.16.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/changelog/2026.10.09.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/changelog/2026.10.30.1.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/changelog/2026.10.30.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/changelog/2026.11.02.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/changelog.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/conf.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/contributing.rst +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/index.rst +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/openapi-spec.rst +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/release-process.rst +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/docs/source/unreleased.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/newsfragments/.gitkeep +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/newsfragments/README.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/openapi.json +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/setup.cfg +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/spelling_private_dict.txt +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank/__init__.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank/_dict_types.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank/_project_archive.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank/_request_types.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank/_responses.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank/_retries.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank/exceptions.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank/py.typed +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank/transports.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank/types.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank.egg-info/dependency_links.txt +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank.egg-info/not-zip-safe +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank.egg-info/requires.txt +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank.egg-info/top_level.txt +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/styles/snapper/LongProseLine.yml +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/styles/snapper/SemanticLineBreaks.yml +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/__init__.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/async_client/__init__.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/async_client/test_configuration.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/async_client/test_endpoints.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/async_client/test_transports.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/client/__init__.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/client/test_configuration.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/client/test_endpoints.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/client/test_errors.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/client/test_transports.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/client_edge_cases/__init__.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/client_edge_cases/constants.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/client_edge_cases/test_errors.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/client_edge_cases/test_pagination.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/client_edge_cases/test_request_bodies.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/client_edge_cases/test_routing.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/client_edge_cases/test_transports.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/conftest.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/endpoints/__init__.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/endpoints/test_assessments.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/endpoints/test_integrations.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/endpoints/test_interviews.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/endpoints/test_organization.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/endpoints/test_questions.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/models/__init__.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/models/test_assessments.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/models/test_candidates.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/models/test_integrations.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/models/test_interviews.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/models/test_organization.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/models/test_pagination.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/openapi_helpers.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/retries/__init__.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/retries/conftest.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/retries/questions.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/retries/responses.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/retries/test_async.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/retries/test_delays.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/retries/test_errors.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/retries/test_logging.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/retries/test_policy.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/retries/test_uploads.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/retries/transports.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/test_candidate_search.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/test_custom_system_prompt.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/test_documented_request_params.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/test_newsfragments.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/test_openapi.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/test_project_directory.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/test_reject_bare_string_lists.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/test_required_update_bodies.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/test_response_shapes.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/test_retry_safety_docs.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/typings/pyprojroot/__init__.pyi +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/zizmor.yml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hackerrank
|
|
3
|
-
Version: 2026.11.
|
|
3
|
+
Version: 2026.11.3.1
|
|
4
4
|
Summary: Interact with the HackerRank for Work API.
|
|
5
5
|
Author-email: Adam Dangoor <adamdangoor@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -68,10 +68,9 @@ Updating private notes
|
|
|
68
68
|
|
|
69
69
|
Use ``client.questions.update_internal_notes(question_id=..., internal_notes=...)`` to change private interviewer notes.
|
|
70
70
|
The same operation is available on ``AsyncHackerRank``.
|
|
71
|
-
Every call
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
HTML comparison policies and question-type restrictions remain with the caller.
|
|
71
|
+
Every call reads the current required question fields and writes the requested notes, including identical or empty notes.
|
|
72
|
+
The operation returns the question supplied by the update response, or ``None`` for an empty response.
|
|
73
|
+
It raises ``ValueError`` if fields required by the update request are absent.
|
|
75
74
|
|
|
76
75
|
HTTPX2 transports
|
|
77
76
|
-----------------
|
|
@@ -42,10 +42,9 @@ Updating private notes
|
|
|
42
42
|
|
|
43
43
|
Use ``client.questions.update_internal_notes(question_id=..., internal_notes=...)`` to change private interviewer notes.
|
|
44
44
|
The same operation is available on ``AsyncHackerRank``.
|
|
45
|
-
Every call
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
HTML comparison policies and question-type restrictions remain with the caller.
|
|
45
|
+
Every call reads the current required question fields and writes the requested notes, including identical or empty notes.
|
|
46
|
+
The operation returns the question supplied by the update response, or ``None`` for an empty response.
|
|
47
|
+
It raises ``ValueError`` if fields required by the update request are absent.
|
|
49
48
|
|
|
50
49
|
HTTPX2 transports
|
|
51
50
|
-----------------
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# 2026.11.03.1 (2026-11-03)
|
|
2
|
+
|
|
3
|
+
## Changes
|
|
4
|
+
|
|
5
|
+
- Remove post-write verification and identity checks from notes updates, along with HTML comparison dependencies.
|
|
6
|
+
Notes updates return the API response question or `None` for an empty response, without an additional read-back request.
|
|
7
|
+
([#508](https://github.com/adamtheturtle/hackerrank/issues/508))
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# 2026.11.03 (2026-11-03)
|
|
2
|
+
|
|
3
|
+
## Changes
|
|
4
|
+
|
|
5
|
+
- Accept harmless HTML serialization changes when verifying saved interviewer notes, while retaining document structure, content, links, code whitespace, and checks for changes to other question fields.
|
|
6
|
+
([#507](https://github.com/adamtheturtle/hackerrank/issues/507))
|
|
@@ -348,8 +348,6 @@ hooks = [
|
|
|
348
348
|
{
|
|
349
349
|
id = "vale-sync",
|
|
350
350
|
name = "vale sync",
|
|
351
|
-
# The Python Vale wrapper may fail transiently while downloading its binary; see
|
|
352
|
-
# https://github.com/daniperez/vale-python-package/issues/77
|
|
353
351
|
entry = "uv run --group=dev vale sync",
|
|
354
352
|
language = "python",
|
|
355
353
|
pass_filenames = false,
|
|
@@ -57,7 +57,7 @@ dev = [
|
|
|
57
57
|
"myst-parser==5.1.0",
|
|
58
58
|
"no-defaults==2026.9.1",
|
|
59
59
|
"openapi-mock==2026.10.9",
|
|
60
|
-
"prek==0.5.
|
|
60
|
+
"prek==0.5.9",
|
|
61
61
|
"pydocstringformatter==1.0.0",
|
|
62
62
|
"pydocstyle==6.3",
|
|
63
63
|
"pygments==2.21.0",
|
|
@@ -95,7 +95,7 @@ dev = [
|
|
|
95
95
|
"sybil==10.1.0",
|
|
96
96
|
"towncrier==26.9.0",
|
|
97
97
|
"ty==0.0.95",
|
|
98
|
-
"vale==3.
|
|
98
|
+
"vale==3.26.0.1",
|
|
99
99
|
"vulture==2.16",
|
|
100
100
|
"yamlfix==1.19.1",
|
|
101
101
|
"zizmor==1.31.1",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""Build required fields for question-note updates."""
|
|
2
|
+
|
|
3
|
+
from hackerrank.types import JSONValue, Question
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def internal_notes_body(
|
|
7
|
+
*, question: Question, internal_notes: str
|
|
8
|
+
) -> dict[str, JSONValue]:
|
|
9
|
+
"""Resend required update fields unchanged and omit optional
|
|
10
|
+
changes.
|
|
11
|
+
"""
|
|
12
|
+
if (
|
|
13
|
+
question.problem_statement is None
|
|
14
|
+
or question.recommended_duration is None
|
|
15
|
+
):
|
|
16
|
+
message = (
|
|
17
|
+
f"Question {question.id} lacks fields required to update notes"
|
|
18
|
+
)
|
|
19
|
+
raise ValueError(message)
|
|
20
|
+
return {
|
|
21
|
+
"name": question.name,
|
|
22
|
+
"type": question.type,
|
|
23
|
+
"internal_notes": internal_notes,
|
|
24
|
+
"languages": []
|
|
25
|
+
if question.languages is None
|
|
26
|
+
else list(question.languages),
|
|
27
|
+
"problem_statement": question.problem_statement,
|
|
28
|
+
"recommended_duration": question.recommended_duration,
|
|
29
|
+
"tags": [] if question.tags is None else list(question.tags),
|
|
30
|
+
"options": [] if question.options is None else list(question.options),
|
|
31
|
+
"answer": [] if question.answer is None else question.answer,
|
|
32
|
+
}
|
|
@@ -29,11 +29,7 @@ from hackerrank._dict_types import (
|
|
|
29
29
|
UserDict,
|
|
30
30
|
UserTeamMembershipDict,
|
|
31
31
|
)
|
|
32
|
-
from hackerrank._internal_notes import
|
|
33
|
-
check_question_id,
|
|
34
|
-
internal_notes_body,
|
|
35
|
-
verify_internal_notes,
|
|
36
|
-
)
|
|
32
|
+
from hackerrank._internal_notes import internal_notes_body
|
|
37
33
|
from hackerrank._project_archive import project_archive
|
|
38
34
|
from hackerrank._request_types import MultipartFiles
|
|
39
35
|
from hackerrank._responses import (
|
|
@@ -1317,12 +1313,11 @@ class AsyncQuestionsNamespace(_AsyncNamespace):
|
|
|
1317
1313
|
*,
|
|
1318
1314
|
question_id: str,
|
|
1319
1315
|
internal_notes: str,
|
|
1320
|
-
) -> Question:
|
|
1321
|
-
"""Update notes
|
|
1322
|
-
preserved.
|
|
1316
|
+
) -> Question | None:
|
|
1317
|
+
"""Update notes using the current required question fields.
|
|
1323
1318
|
|
|
1324
|
-
Reads the current question
|
|
1325
|
-
fields unchanged
|
|
1319
|
+
Reads the current question and sends the requested notes with
|
|
1320
|
+
required fields unchanged.
|
|
1326
1321
|
Every call writes notes, including when the text is unchanged.
|
|
1327
1322
|
|
|
1328
1323
|
Safe to retry: the request replaces notes and required fields.
|
|
@@ -1332,14 +1327,14 @@ class AsyncQuestionsNamespace(_AsyncNamespace):
|
|
|
1332
1327
|
internal_notes: Desired private interviewer notes.
|
|
1333
1328
|
|
|
1334
1329
|
Returns:
|
|
1335
|
-
The
|
|
1330
|
+
The updated question when returned by the API, otherwise
|
|
1331
|
+
``None``.
|
|
1336
1332
|
|
|
1337
1333
|
Raises:
|
|
1338
|
-
ValueError: If required fields are absent
|
|
1334
|
+
ValueError: If required fields are absent.
|
|
1339
1335
|
"""
|
|
1340
1336
|
current = await self.get(question_id=question_id)
|
|
1341
|
-
|
|
1342
|
-
_ = await self._request(
|
|
1337
|
+
response = await self._request(
|
|
1343
1338
|
method="PUT",
|
|
1344
1339
|
url=f"{_API_V3}/questions/{question_id}",
|
|
1345
1340
|
json=internal_notes_body(
|
|
@@ -1349,13 +1344,11 @@ class AsyncQuestionsNamespace(_AsyncNamespace):
|
|
|
1349
1344
|
files=None,
|
|
1350
1345
|
repeatable=True,
|
|
1351
1346
|
)
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
)
|
|
1358
|
-
return after
|
|
1347
|
+
if bool(response.content):
|
|
1348
|
+
return Question.from_dict(
|
|
1349
|
+
data=response_data(response.json(), QuestionDict)
|
|
1350
|
+
)
|
|
1351
|
+
return None
|
|
1359
1352
|
|
|
1360
1353
|
async def upload_project_directory(
|
|
1361
1354
|
self,
|
|
@@ -28,11 +28,7 @@ from hackerrank._dict_types import (
|
|
|
28
28
|
UserDict,
|
|
29
29
|
UserTeamMembershipDict,
|
|
30
30
|
)
|
|
31
|
-
from hackerrank._internal_notes import
|
|
32
|
-
check_question_id,
|
|
33
|
-
internal_notes_body,
|
|
34
|
-
verify_internal_notes,
|
|
35
|
-
)
|
|
31
|
+
from hackerrank._internal_notes import internal_notes_body
|
|
36
32
|
from hackerrank._project_archive import project_archive
|
|
37
33
|
from hackerrank._request_types import MultipartFiles
|
|
38
34
|
from hackerrank._responses import (
|
|
@@ -1280,12 +1276,11 @@ class QuestionsNamespace(_Namespace):
|
|
|
1280
1276
|
*,
|
|
1281
1277
|
question_id: str,
|
|
1282
1278
|
internal_notes: str,
|
|
1283
|
-
) -> Question:
|
|
1284
|
-
"""Update notes
|
|
1285
|
-
preserved.
|
|
1279
|
+
) -> Question | None:
|
|
1280
|
+
"""Update notes using the current required question fields.
|
|
1286
1281
|
|
|
1287
|
-
Reads the current question
|
|
1288
|
-
fields unchanged
|
|
1282
|
+
Reads the current question and sends the requested notes with
|
|
1283
|
+
required fields unchanged.
|
|
1289
1284
|
Every call writes notes, including when the text is unchanged.
|
|
1290
1285
|
|
|
1291
1286
|
Safe to retry: the request replaces notes and required fields.
|
|
@@ -1295,14 +1290,14 @@ class QuestionsNamespace(_Namespace):
|
|
|
1295
1290
|
internal_notes: Desired private interviewer notes.
|
|
1296
1291
|
|
|
1297
1292
|
Returns:
|
|
1298
|
-
The
|
|
1293
|
+
The updated question when returned by the API, otherwise
|
|
1294
|
+
``None``.
|
|
1299
1295
|
|
|
1300
1296
|
Raises:
|
|
1301
|
-
ValueError: If required fields are absent
|
|
1297
|
+
ValueError: If required fields are absent.
|
|
1302
1298
|
"""
|
|
1303
1299
|
current = self.get(question_id=question_id)
|
|
1304
|
-
|
|
1305
|
-
_ = self._request(
|
|
1300
|
+
response = self._request(
|
|
1306
1301
|
method="PUT",
|
|
1307
1302
|
url=f"{_API_V3}/questions/{question_id}",
|
|
1308
1303
|
json=internal_notes_body(
|
|
@@ -1312,13 +1307,11 @@ class QuestionsNamespace(_Namespace):
|
|
|
1312
1307
|
files=None,
|
|
1313
1308
|
repeatable=True,
|
|
1314
1309
|
)
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
)
|
|
1321
|
-
return after
|
|
1310
|
+
if bool(response.content):
|
|
1311
|
+
return Question.from_dict(
|
|
1312
|
+
data=response_data(response.json(), QuestionDict)
|
|
1313
|
+
)
|
|
1314
|
+
return None
|
|
1322
1315
|
|
|
1323
1316
|
def upload_project_directory(
|
|
1324
1317
|
self,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hackerrank
|
|
3
|
-
Version: 2026.11.
|
|
3
|
+
Version: 2026.11.3.1
|
|
4
4
|
Summary: Interact with the HackerRank for Work API.
|
|
5
5
|
Author-email: Adam Dangoor <adamdangoor@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -68,10 +68,9 @@ Updating private notes
|
|
|
68
68
|
|
|
69
69
|
Use ``client.questions.update_internal_notes(question_id=..., internal_notes=...)`` to change private interviewer notes.
|
|
70
70
|
The same operation is available on ``AsyncHackerRank``.
|
|
71
|
-
Every call
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
HTML comparison policies and question-type restrictions remain with the caller.
|
|
71
|
+
Every call reads the current required question fields and writes the requested notes, including identical or empty notes.
|
|
72
|
+
The operation returns the question supplied by the update response, or ``None`` for an empty response.
|
|
73
|
+
It raises ``ValueError`` if fields required by the update request are absent.
|
|
75
74
|
|
|
76
75
|
HTTPX2 transports
|
|
77
76
|
-----------------
|
|
@@ -44,6 +44,8 @@ docs/source/changelog/2026.10.09.md
|
|
|
44
44
|
docs/source/changelog/2026.10.30.1.md
|
|
45
45
|
docs/source/changelog/2026.10.30.md
|
|
46
46
|
docs/source/changelog/2026.11.02.md
|
|
47
|
+
docs/source/changelog/2026.11.03.1.md
|
|
48
|
+
docs/source/changelog/2026.11.03.md
|
|
47
49
|
newsfragments/.gitkeep
|
|
48
50
|
newsfragments/README.md
|
|
49
51
|
src/hackerrank/__init__.py
|
|
@@ -35,6 +35,8 @@
|
|
|
35
35
|
"docs/source/changelog/2026.10.30.1.md",
|
|
36
36
|
"docs/source/changelog/2026.10.30.md",
|
|
37
37
|
"docs/source/changelog/2026.11.02.md",
|
|
38
|
+
"docs/source/changelog/2026.11.03.1.md",
|
|
39
|
+
"docs/source/changelog/2026.11.03.md",
|
|
38
40
|
"docs/source/conf.py",
|
|
39
41
|
"docs/source/contributing.rst",
|
|
40
42
|
"docs/source/index.rst",
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"""Notes updates use required fields and return the API response."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
import pytest
|
|
7
|
+
import respx
|
|
8
|
+
from beartype import beartype
|
|
9
|
+
|
|
10
|
+
from hackerrank.async_client import AsyncHackerRank
|
|
11
|
+
from hackerrank.client import HackerRank
|
|
12
|
+
from hackerrank.transports import AsyncHTTPXTransport, HTTPXTransport
|
|
13
|
+
from hackerrank.types import JSONValue, Question
|
|
14
|
+
|
|
15
|
+
_URL = "https://www.hackerrank.com/x/api/v3/questions/q1"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _question() -> dict[str, JSONValue]:
|
|
19
|
+
"""Supply required fields and unrelated project configuration."""
|
|
20
|
+
return {
|
|
21
|
+
"id": "q1",
|
|
22
|
+
"name": "Question",
|
|
23
|
+
"type": "code",
|
|
24
|
+
"problem_statement": "Candidate prompt",
|
|
25
|
+
"recommended_duration": 60,
|
|
26
|
+
"internal_notes": "Previous notes",
|
|
27
|
+
"languages": ["python3"],
|
|
28
|
+
"tags": ["AI"],
|
|
29
|
+
"options": ["choice"],
|
|
30
|
+
"answer": 0,
|
|
31
|
+
"max_score": 100.0,
|
|
32
|
+
"environment_id": 112,
|
|
33
|
+
"custom_system_prompt": " Keep this prompt.\n",
|
|
34
|
+
"fullstack_project_details": {
|
|
35
|
+
"configuration": {"menu": {"run": "python3 solution.py"}}
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@beartype
|
|
41
|
+
def _json_object(*, value: dict[str, JSONValue]) -> dict[str, JSONValue]:
|
|
42
|
+
"""Check JSON at the outgoing request boundary."""
|
|
43
|
+
return value
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
async def _update(*, use_async: bool, notes: str) -> Question | None:
|
|
47
|
+
"""Exercise the public operation through either transport."""
|
|
48
|
+
if use_async:
|
|
49
|
+
async with (
|
|
50
|
+
AsyncHTTPXTransport() as transport,
|
|
51
|
+
AsyncHackerRank(api_key="test-key", transport=transport) as client,
|
|
52
|
+
):
|
|
53
|
+
return await client.questions.update_internal_notes(
|
|
54
|
+
question_id="q1", internal_notes=notes
|
|
55
|
+
)
|
|
56
|
+
with (
|
|
57
|
+
HTTPXTransport() as sync_transport,
|
|
58
|
+
HackerRank(
|
|
59
|
+
api_key="test-key", transport=sync_transport
|
|
60
|
+
) as sync_client,
|
|
61
|
+
):
|
|
62
|
+
return sync_client.questions.update_internal_notes(
|
|
63
|
+
question_id="q1", internal_notes=notes
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@pytest.mark.asyncio
|
|
68
|
+
@pytest.mark.parametrize(argnames="use_async", argvalues=[False, True])
|
|
69
|
+
@pytest.mark.parametrize(argnames="nullable", argvalues=[False, True])
|
|
70
|
+
@pytest.mark.parametrize(argnames="response_body", argvalues=[False, True])
|
|
71
|
+
async def test_notes_update(
|
|
72
|
+
*, use_async: bool, nullable: bool, response_body: bool
|
|
73
|
+
) -> None:
|
|
74
|
+
"""One GET supplies required fields, followed by the requested PUT."""
|
|
75
|
+
current = _question()
|
|
76
|
+
if nullable:
|
|
77
|
+
for field in ("languages", "tags", "options", "answer"):
|
|
78
|
+
del current[field]
|
|
79
|
+
returned = {**current, "internal_notes": "Server-formatted notes"}
|
|
80
|
+
with respx.mock(assert_all_called=True) as router:
|
|
81
|
+
get = router.get(url=_URL).respond(status_code=200, json=current)
|
|
82
|
+
put = router.put(url=_URL).mock(
|
|
83
|
+
return_value=httpx.Response(status_code=200, json=returned)
|
|
84
|
+
if response_body
|
|
85
|
+
else httpx.Response(status_code=204)
|
|
86
|
+
)
|
|
87
|
+
result = await _update(use_async=use_async, notes="New notes")
|
|
88
|
+
body = _json_object(value=json.loads(s=put.calls.last.request.content))
|
|
89
|
+
assert set(body) == {
|
|
90
|
+
"name",
|
|
91
|
+
"type",
|
|
92
|
+
"internal_notes",
|
|
93
|
+
"languages",
|
|
94
|
+
"problem_statement",
|
|
95
|
+
"recommended_duration",
|
|
96
|
+
"tags",
|
|
97
|
+
"options",
|
|
98
|
+
"answer",
|
|
99
|
+
}
|
|
100
|
+
assert body["internal_notes"] == "New notes"
|
|
101
|
+
for field in (
|
|
102
|
+
"name",
|
|
103
|
+
"type",
|
|
104
|
+
"problem_statement",
|
|
105
|
+
"recommended_duration",
|
|
106
|
+
):
|
|
107
|
+
assert body[field] == current[field]
|
|
108
|
+
for field in ("languages", "tags", "options", "answer"):
|
|
109
|
+
assert body[field] == current.get(field, [])
|
|
110
|
+
if response_body:
|
|
111
|
+
assert result is not None
|
|
112
|
+
assert result.internal_notes == "Server-formatted notes"
|
|
113
|
+
else:
|
|
114
|
+
assert result is None
|
|
115
|
+
assert get.call_count == 1
|
|
116
|
+
assert put.call_count == 1
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
@pytest.mark.asyncio
|
|
120
|
+
@pytest.mark.parametrize(argnames="use_async", argvalues=[False, True])
|
|
121
|
+
@pytest.mark.parametrize(argnames="notes", argvalues=["Previous notes", ""])
|
|
122
|
+
async def test_notes_are_always_written(
|
|
123
|
+
*, use_async: bool, notes: str
|
|
124
|
+
) -> None:
|
|
125
|
+
"""Unchanged and empty notes still produce an update request."""
|
|
126
|
+
with respx.mock(assert_all_called=True) as router:
|
|
127
|
+
get = router.get(url=_URL).respond(status_code=200, json=_question())
|
|
128
|
+
put = router.put(url=_URL).respond(status_code=204)
|
|
129
|
+
assert await _update(use_async=use_async, notes=notes) is None
|
|
130
|
+
assert (
|
|
131
|
+
json.loads(s=put.calls.last.request.content)["internal_notes"]
|
|
132
|
+
== notes
|
|
133
|
+
)
|
|
134
|
+
assert get.call_count == 1
|
|
135
|
+
assert put.call_count == 1
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
@pytest.mark.asyncio
|
|
139
|
+
@pytest.mark.parametrize(argnames="use_async", argvalues=[False, True])
|
|
140
|
+
@pytest.mark.parametrize(
|
|
141
|
+
argnames="missing", argvalues=["problem_statement", "recommended_duration"]
|
|
142
|
+
)
|
|
143
|
+
async def test_required_fields_must_be_available(
|
|
144
|
+
*, use_async: bool, missing: str
|
|
145
|
+
) -> None:
|
|
146
|
+
"""The API-required update fields must be available to build the
|
|
147
|
+
body.
|
|
148
|
+
"""
|
|
149
|
+
current = _question()
|
|
150
|
+
del current[missing]
|
|
151
|
+
with respx.mock(assert_all_called=True) as router:
|
|
152
|
+
get = router.get(url=_URL).respond(status_code=200, json=current)
|
|
153
|
+
with pytest.raises(
|
|
154
|
+
expected_exception=ValueError, match="lacks fields"
|
|
155
|
+
):
|
|
156
|
+
_ = await _update(use_async=use_async, notes="New notes")
|
|
157
|
+
assert get.call_count == 1
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"""Prepare and verify updates that change only question notes."""
|
|
2
|
-
|
|
3
|
-
from dataclasses import replace
|
|
4
|
-
|
|
5
|
-
from hackerrank.types import JSONValue, Question
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def check_question_id(*, question: Question, question_id: str) -> None:
|
|
9
|
-
"""Reject a response for a different question before any update."""
|
|
10
|
-
if question.id != question_id:
|
|
11
|
-
message = f"Expected question {question_id}, received {question.id}"
|
|
12
|
-
raise ValueError(message)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def internal_notes_body(
|
|
16
|
-
*, question: Question, internal_notes: str
|
|
17
|
-
) -> dict[str, JSONValue]:
|
|
18
|
-
"""Resend required update fields unchanged and omit optional
|
|
19
|
-
changes.
|
|
20
|
-
"""
|
|
21
|
-
if (
|
|
22
|
-
question.problem_statement is None
|
|
23
|
-
or question.recommended_duration is None
|
|
24
|
-
):
|
|
25
|
-
message = (
|
|
26
|
-
f"Question {question.id} lacks fields required to update notes"
|
|
27
|
-
)
|
|
28
|
-
raise ValueError(message)
|
|
29
|
-
return {
|
|
30
|
-
"name": question.name,
|
|
31
|
-
"type": question.type,
|
|
32
|
-
"internal_notes": internal_notes,
|
|
33
|
-
"languages": []
|
|
34
|
-
if question.languages is None
|
|
35
|
-
else list(question.languages),
|
|
36
|
-
"problem_statement": question.problem_statement,
|
|
37
|
-
"recommended_duration": question.recommended_duration,
|
|
38
|
-
"tags": [] if question.tags is None else list(question.tags),
|
|
39
|
-
"options": [] if question.options is None else list(question.options),
|
|
40
|
-
"answer": [] if question.answer is None else question.answer,
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def _without_notes(*, question: Question) -> Question:
|
|
45
|
-
"""Normalize optional required lists while retaining scalar
|
|
46
|
-
answers.
|
|
47
|
-
"""
|
|
48
|
-
return replace(
|
|
49
|
-
question,
|
|
50
|
-
internal_notes=None,
|
|
51
|
-
languages=[] if question.languages is None else question.languages,
|
|
52
|
-
tags=[] if question.tags is None else question.tags,
|
|
53
|
-
options=[] if question.options is None else question.options,
|
|
54
|
-
answer=[] if question.answer is None else question.answer,
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
def verify_internal_notes(
|
|
59
|
-
*,
|
|
60
|
-
before: Question,
|
|
61
|
-
after: Question,
|
|
62
|
-
internal_notes: str,
|
|
63
|
-
) -> None:
|
|
64
|
-
"""Verify saved notes and every other modeled question field."""
|
|
65
|
-
actual = "" if after.internal_notes is None else after.internal_notes
|
|
66
|
-
if actual != internal_notes:
|
|
67
|
-
message = f"HackerRank did not retain notes for question {before.id}"
|
|
68
|
-
raise ValueError(message)
|
|
69
|
-
if _without_notes(question=before) != _without_notes(question=after):
|
|
70
|
-
message = f"Question {before.id} changed fields other than notes"
|
|
71
|
-
raise ValueError(message)
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
"""Notes-only updates preserve question state in both API clients."""
|
|
2
|
-
|
|
3
|
-
import json
|
|
4
|
-
|
|
5
|
-
import httpx
|
|
6
|
-
import pytest
|
|
7
|
-
import respx
|
|
8
|
-
from beartype import beartype
|
|
9
|
-
|
|
10
|
-
from hackerrank.async_client import AsyncHackerRank
|
|
11
|
-
from hackerrank.client import HackerRank
|
|
12
|
-
from hackerrank.transports import AsyncHTTPXTransport, HTTPXTransport
|
|
13
|
-
from hackerrank.types import JSONValue, Question
|
|
14
|
-
|
|
15
|
-
_URL = "https://www.hackerrank.com/x/api/v3/questions/q1"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def _question() -> dict[str, JSONValue]:
|
|
19
|
-
"""Supply required fields and unrelated project configuration."""
|
|
20
|
-
return {
|
|
21
|
-
"id": "q1",
|
|
22
|
-
"name": "Question",
|
|
23
|
-
"type": "code",
|
|
24
|
-
"problem_statement": "Candidate prompt",
|
|
25
|
-
"recommended_duration": 60,
|
|
26
|
-
"internal_notes": "Previous notes",
|
|
27
|
-
"languages": ["python3"],
|
|
28
|
-
"tags": ["AI"],
|
|
29
|
-
"options": ["choice"],
|
|
30
|
-
"answer": [1],
|
|
31
|
-
"max_score": 100.0,
|
|
32
|
-
"environment_id": 112,
|
|
33
|
-
"custom_system_prompt": " Keep this prompt.\n",
|
|
34
|
-
"fullstack_project_details": {
|
|
35
|
-
"configuration": {"menu": {"run": "python3 solution.py"}}
|
|
36
|
-
},
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
@beartype
|
|
41
|
-
def _json_object(*, value: dict[str, JSONValue]) -> dict[str, JSONValue]:
|
|
42
|
-
"""Check JSON at the outgoing request boundary."""
|
|
43
|
-
return value
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
async def _update(
|
|
47
|
-
*,
|
|
48
|
-
use_async: bool,
|
|
49
|
-
notes: str,
|
|
50
|
-
) -> Question:
|
|
51
|
-
"""Exercise the same public operation through either transport."""
|
|
52
|
-
if use_async:
|
|
53
|
-
async with (
|
|
54
|
-
AsyncHTTPXTransport() as async_transport,
|
|
55
|
-
AsyncHackerRank(
|
|
56
|
-
api_key="test-key", transport=async_transport
|
|
57
|
-
) as async_client,
|
|
58
|
-
):
|
|
59
|
-
return await async_client.questions.update_internal_notes(
|
|
60
|
-
question_id="q1",
|
|
61
|
-
internal_notes=notes,
|
|
62
|
-
)
|
|
63
|
-
with (
|
|
64
|
-
HTTPXTransport() as transport,
|
|
65
|
-
HackerRank(api_key="test-key", transport=transport) as client,
|
|
66
|
-
):
|
|
67
|
-
return client.questions.update_internal_notes(
|
|
68
|
-
question_id="q1",
|
|
69
|
-
internal_notes=notes,
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
@pytest.mark.asyncio
|
|
74
|
-
@pytest.mark.parametrize(argnames="use_async", argvalues=[False, True])
|
|
75
|
-
@pytest.mark.parametrize(argnames="nullable", argvalues=[False, True])
|
|
76
|
-
async def test_notes_only_update(*, use_async: bool, nullable: bool) -> None:
|
|
77
|
-
"""Read current state, send required fields only, and read back
|
|
78
|
-
notes.
|
|
79
|
-
"""
|
|
80
|
-
before = _question()
|
|
81
|
-
after = {**before, "internal_notes": "New notes"}
|
|
82
|
-
if nullable:
|
|
83
|
-
for field in ("languages", "tags", "options", "answer"):
|
|
84
|
-
del before[field]
|
|
85
|
-
after[field] = []
|
|
86
|
-
with respx.mock(assert_all_called=True) as router:
|
|
87
|
-
get = router.get(url=_URL)
|
|
88
|
-
_ = get.mock(
|
|
89
|
-
side_effect=[
|
|
90
|
-
httpx.Response(status_code=200, json=before),
|
|
91
|
-
httpx.Response(status_code=200, json=after),
|
|
92
|
-
]
|
|
93
|
-
)
|
|
94
|
-
put = router.put(url=_URL).respond(status_code=204)
|
|
95
|
-
result = await _update(use_async=use_async, notes="New notes")
|
|
96
|
-
body = _json_object(value=json.loads(s=put.calls.last.request.content))
|
|
97
|
-
assert set(body) == {
|
|
98
|
-
"name",
|
|
99
|
-
"type",
|
|
100
|
-
"internal_notes",
|
|
101
|
-
"languages",
|
|
102
|
-
"problem_statement",
|
|
103
|
-
"recommended_duration",
|
|
104
|
-
"tags",
|
|
105
|
-
"options",
|
|
106
|
-
"answer",
|
|
107
|
-
}
|
|
108
|
-
assert body["internal_notes"] == "New notes"
|
|
109
|
-
for field in (
|
|
110
|
-
"name",
|
|
111
|
-
"type",
|
|
112
|
-
"problem_statement",
|
|
113
|
-
"recommended_duration",
|
|
114
|
-
):
|
|
115
|
-
assert body[field] == before[field]
|
|
116
|
-
for field in ("languages", "tags", "options", "answer"):
|
|
117
|
-
assert body[field] == before.get(field, [])
|
|
118
|
-
assert result.custom_system_prompt == " Keep this prompt.\n"
|
|
119
|
-
expected_reads = 2
|
|
120
|
-
assert get.call_count == expected_reads
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
@pytest.mark.asyncio
|
|
124
|
-
@pytest.mark.parametrize(argnames="use_async", argvalues=[False, True])
|
|
125
|
-
async def test_unchanged_notes_are_written(*, use_async: bool) -> None:
|
|
126
|
-
"""Identical notes still receive a PUT and a verified read-back."""
|
|
127
|
-
question = _question()
|
|
128
|
-
with respx.mock(assert_all_called=True) as router:
|
|
129
|
-
get = router.get(url=_URL).respond(status_code=200, json=question)
|
|
130
|
-
put = router.put(url=_URL).respond(status_code=204)
|
|
131
|
-
result = await _update(use_async=use_async, notes="Previous notes")
|
|
132
|
-
assert result.internal_notes == "Previous notes"
|
|
133
|
-
body = _json_object(value=json.loads(s=put.calls.last.request.content))
|
|
134
|
-
assert body["internal_notes"] == "Previous notes"
|
|
135
|
-
expected_reads = 2
|
|
136
|
-
assert get.call_count == expected_reads
|
|
137
|
-
assert put.call_count == 1
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
@pytest.mark.asyncio
|
|
141
|
-
@pytest.mark.parametrize(argnames="use_async", argvalues=[False, True])
|
|
142
|
-
@pytest.mark.parametrize(
|
|
143
|
-
argnames="invalid",
|
|
144
|
-
argvalues=["id", "problem_statement", "recommended_duration"],
|
|
145
|
-
)
|
|
146
|
-
async def test_invalid_current_question_prevents_write(
|
|
147
|
-
*, use_async: bool, invalid: str
|
|
148
|
-
) -> None:
|
|
149
|
-
"""Reject mismatched identities and incomplete required fields."""
|
|
150
|
-
before = _question()
|
|
151
|
-
if invalid == "id":
|
|
152
|
-
before["id"] = "other"
|
|
153
|
-
else:
|
|
154
|
-
del before[invalid]
|
|
155
|
-
with respx.mock(assert_all_called=True) as router:
|
|
156
|
-
get = router.get(url=_URL).respond(status_code=200, json=before)
|
|
157
|
-
with pytest.raises(
|
|
158
|
-
expected_exception=ValueError,
|
|
159
|
-
match="Expected question" if invalid == "id" else "lacks fields",
|
|
160
|
-
):
|
|
161
|
-
_ = await _update(use_async=use_async, notes="New notes")
|
|
162
|
-
assert get.call_count == 1
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
@pytest.mark.asyncio
|
|
166
|
-
@pytest.mark.parametrize(argnames="use_async", argvalues=[False, True])
|
|
167
|
-
@pytest.mark.parametrize(
|
|
168
|
-
argnames="changed",
|
|
169
|
-
argvalues=["internal_notes", "custom_system_prompt", "answer"],
|
|
170
|
-
)
|
|
171
|
-
async def test_unexpected_readback_fails(
|
|
172
|
-
*, use_async: bool, changed: str
|
|
173
|
-
) -> None:
|
|
174
|
-
"""Check saved text and every modeled field, including scalar zero."""
|
|
175
|
-
before = {**_question(), "answer": 0}
|
|
176
|
-
after = {**before, "internal_notes": "New notes"}
|
|
177
|
-
after[changed] = [] if changed == "answer" else "Unexpected"
|
|
178
|
-
with respx.mock(assert_all_called=True) as router:
|
|
179
|
-
get = router.get(url=_URL)
|
|
180
|
-
_ = get.mock(
|
|
181
|
-
side_effect=[
|
|
182
|
-
httpx.Response(status_code=200, json=before),
|
|
183
|
-
httpx.Response(status_code=200, json=after),
|
|
184
|
-
]
|
|
185
|
-
)
|
|
186
|
-
_ = router.put(url=_URL).respond(status_code=204)
|
|
187
|
-
with pytest.raises(
|
|
188
|
-
expected_exception=ValueError,
|
|
189
|
-
match="did not retain notes"
|
|
190
|
-
if changed == "internal_notes"
|
|
191
|
-
else "changed fields other than notes",
|
|
192
|
-
):
|
|
193
|
-
_ = await _update(use_async=use_async, notes="New notes")
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
@pytest.mark.asyncio
|
|
197
|
-
@pytest.mark.parametrize(argnames="use_async", argvalues=[False, True])
|
|
198
|
-
async def test_absent_notes_are_empty(*, use_async: bool) -> None:
|
|
199
|
-
"""Clearing absent notes still writes and verifies an empty result."""
|
|
200
|
-
question = _question()
|
|
201
|
-
del question["internal_notes"]
|
|
202
|
-
with respx.mock(assert_all_called=True) as router:
|
|
203
|
-
get = router.get(url=_URL).respond(status_code=200, json=question)
|
|
204
|
-
put = router.put(url=_URL).respond(status_code=204)
|
|
205
|
-
result = await _update(use_async=use_async, notes="")
|
|
206
|
-
assert result.internal_notes is None
|
|
207
|
-
body = _json_object(value=json.loads(s=put.calls.last.request.content))
|
|
208
|
-
assert body["internal_notes"] == ""
|
|
209
|
-
expected_reads = 2
|
|
210
|
-
assert get.call_count == expected_reads
|
|
211
|
-
assert put.call_count == 1
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/src/hackerrank.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hackerrank-2026.11.2 → hackerrank-2026.11.3.1}/tests/client_edge_cases/test_request_bodies.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|