Skip to content

Commit 144e727

Browse files
fix(adms): use ty: ignore syntax; restore .gitignore ADMS entries
ty uses its own comment syntax (# ty: ignore[rule]) distinct from mypy's (# type: ignore[rule]). The previous commit used mypy syntax which ty ignores, leaving the errors unsuppressed. Affected lines: test_client.py:91-92 invalid-assignment (MagicMock on method slots) test_client.py:426 invalid-assignment (MagicMock on with_user_jwt) test_client.py:432 unresolved-attribute (assert_called_once_with) test_http.py:274 invalid-argument-type (quote_odata_guid_key(None)) test_query_options.py:86 unknown-argument (orderby on RelationQueryOptions) .gitignore: restore ADMS-specific entries (.env.adms, scripts/adms_cli.py, .DS_Store, .ucl-provision/) that were dropped during the upstream rebase. Also adds the trailing newline that end-of-file-fixer requires.
1 parent 9755bf7 commit 144e727

4 files changed

Lines changed: 18 additions & 7 deletions

File tree

.gitignore

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,15 @@ mocks/
3838

3939
# Generated files
4040
PULL_REQUEST.md
41-
RELEASE.md
41+
RELEASE.md
42+
43+
# macOS metadata
44+
.DS_Store
45+
46+
# UCL provisioning artefacts (separate repo concern)
47+
.ucl-provision/
48+
src/sap_cloud_sdk/adms/ucl/
49+
50+
# ADMS local dev files (credentials + debug CLI — never commit)
51+
.env.adms
52+
scripts/adms_cli.py

tests/adms/unit/test_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ def _make_httpx_response(
8888

8989
def _make_token_fetcher(config: AdmsConfig) -> IasTokenFetcher:
9090
fetcher = IasTokenFetcher(config=config)
91-
fetcher.get_token = MagicMock(return_value="test-bearer-token") # type: ignore[assignment, method-assign]
92-
fetcher.exchange_token = MagicMock(return_value="user-bearer-token") # type: ignore[assignment, method-assign]
91+
fetcher.get_token = MagicMock(return_value="test-bearer-token") # type: ignore[method-assign] # ty: ignore[invalid-assignment]
92+
fetcher.exchange_token = MagicMock(return_value="user-bearer-token") # type: ignore[method-assign] # ty: ignore[invalid-assignment]
9393
return fetcher
9494

9595

@@ -423,13 +423,13 @@ def test_with_user_jwt_returns_new_instance(self, config):
423423
http = _make_async_http(config, fetcher)
424424
mock_user_http = MagicMock(spec=AsyncAdmsHttp)
425425
mock_user_http._client = AsyncMock(spec=httpx.AsyncClient)
426-
http.with_user_jwt = MagicMock(return_value=mock_user_http) # type: ignore[assignment, method-assign]
426+
http.with_user_jwt = MagicMock(return_value=mock_user_http) # type: ignore[method-assign] # ty: ignore[invalid-assignment]
427427

428428
client = AsyncAdmsClient(http)
429429
new_client = client.with_user_jwt("my-jwt")
430430

431431
assert new_client is not client
432-
http.with_user_jwt.assert_called_once_with("my-jwt") # type: ignore[union-attr, attr-defined]
432+
http.with_user_jwt.assert_called_once_with("my-jwt") # type: ignore[union-attr] # ty: ignore[unresolved-attribute]
433433
assert new_client._http is mock_user_http
434434

435435
@pytest.mark.asyncio

tests/adms/unit/test_http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def test_non_string_raises(self):
271271
# The signature is str, but defend against accidental int / None
272272
# callers — should surface as ValueError, not TypeError.
273273
with pytest.raises(ValueError, match="invalid OData Edm.Guid key"):
274-
quote_odata_guid_key(None) # type: ignore[arg-type, argument-type]
274+
quote_odata_guid_key(None) # type: ignore[arg-type] # ty: ignore[invalid-argument-type]
275275

276276

277277
class TestAdmsHttpThreadSafety:

tests/adms/unit/test_query_options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_orderby_not_accepted(self):
8383
# $orderby is reserved for DocumentQueryOptions — RelationQueryOptions
8484
# must not silently accept it as a kwarg.
8585
with pytest.raises(TypeError):
86-
RelationQueryOptions(orderby="CreatedAt desc") # type: ignore[call-arg, unknown-argument]
86+
RelationQueryOptions(orderby="CreatedAt desc") # type: ignore[call-arg] # ty: ignore[unknown-argument]
8787

8888

8989
class TestDocumentQueryOptions:

0 commit comments

Comments
 (0)