Skip to content

Commit 7503ebd

Browse files
authored
Merge pull request #1803 from tisnik/lcore-2334-use-specific-rule-codes-2
LCORE-2334: use specific rule codes
2 parents 7b1258b + 96bcdf1 commit 7503ebd

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

tests/unit/cache/test_sqlite_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def test_connected_when_connection_error(tmpdir: Path) -> None:
154154
# simulate connection error
155155
cache = create_cache(tmpdir)
156156
# connection can have any type
157-
cache.connection = ConnectionMock() # pyright: ignore
157+
cache.connection = ConnectionMock() # pyright: ignore[reportAttributeAccessIssue]
158158
assert cache.connection is not None
159159
assert cache.connected() is False
160160

tests/unit/models/requests/test_vector_store_requests.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_attributes_max_16_pairs(self) -> None:
8686
request = VectorStoreFileCreateRequest(
8787
file_id="file-abc123", attributes=attributes, chunking_strategy=None
8888
)
89-
assert len(request.attributes) == 16 # type: ignore
89+
assert len(request.attributes) == 16 # pyright: ignore[reportArgumentType]
9090

9191
def test_attributes_exceeds_16_pairs(self) -> None:
9292
"""Test that attributes with more than 16 pairs is rejected."""
@@ -107,7 +107,9 @@ def test_attributes_key_max_64_chars(self) -> None:
107107
request = VectorStoreFileCreateRequest(
108108
file_id="file-abc123", attributes=attributes, chunking_strategy=None
109109
)
110-
assert key_64_chars in request.attributes # type: ignore
110+
assert (
111+
key_64_chars in request.attributes
112+
) # pyright: ignore[reportOperatorIssue]
111113

112114
def test_attributes_key_exceeds_64_chars(self) -> None:
113115
"""Test that attribute keys exceeding 64 characters are rejected."""
@@ -125,7 +127,9 @@ def test_attributes_string_value_max_512_chars(self) -> None:
125127
request = VectorStoreFileCreateRequest(
126128
file_id="file-abc123", attributes=attributes, chunking_strategy=None
127129
)
128-
assert request.attributes["key"] == value_512_chars # type: ignore
130+
assert isinstance(request.attributes, dict)
131+
assert "key" in request.attributes
132+
assert request.attributes["key"] == value_512_chars
129133

130134
def test_attributes_string_value_exceeds_512_chars(self) -> None:
131135
"""Test that string attribute values exceeding 512 characters are rejected."""
@@ -170,7 +174,7 @@ def test_attributes_none_is_valid(self) -> None:
170174
def test_file_id_required(self) -> None:
171175
"""Test that file_id is required."""
172176
with pytest.raises(ValidationError):
173-
VectorStoreFileCreateRequest() # type: ignore
177+
VectorStoreFileCreateRequest() # pyright: ignore[reportCallIssue]
174178

175179
def test_file_id_cannot_be_empty(self) -> None:
176180
"""Test that file_id cannot be an empty string."""

tests/unit/quota/test_quota_limiter_factory.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def test_quota_limiters_no_limiters_pg_storage() -> None:
4040
gss_encmode=constants.POSTGRES_DEFAULT_GSS_ENCMODE,
4141
ca_cert_path=None,
4242
)
43-
configuration.limiters = None # pyright: ignore
43+
configuration.limiters = None # pyright: ignore[reportAttributeAccessIssue]
4444
limiters = QuotaLimiterFactory.quota_limiters(configuration)
4545
assert not limiters
4646

@@ -51,7 +51,7 @@ def test_quota_limiters_no_limiters_sqlite_storage() -> None:
5151
configuration.sqlite = SQLiteDatabaseConfiguration(
5252
db_path="/foo/bar",
5353
)
54-
configuration.limiters = None # pyright: ignore
54+
configuration.limiters = None # pyright: ignore[reportAttributeAccessIssue]
5555
limiters = QuotaLimiterFactory.quota_limiters(configuration)
5656
assert not limiters
5757

@@ -274,7 +274,9 @@ def test_quota_limiters_invalid_limiter_type(mocker: MockerFixture) -> None:
274274
period="5 days",
275275
),
276276
]
277-
configuration.limiters[0].type = "foo" # pyright: ignore
277+
configuration.limiters[0].type = (
278+
"foo" # pyright: ignore[reportAttributeAccessIssue]
279+
)
278280
# do not use connection to real PostgreSQL instance
279281
mocker.patch("psycopg2.connect")
280282
with pytest.raises(ValueError, match="Invalid limiter type: foo"):

0 commit comments

Comments
 (0)