Skip to content

Commit e92eac2

Browse files
authored
Enabled pylint:pointless-statement. (opensearch-project#611)
Signed-off-by: dblock <dblock@amazon.com>
1 parent 1801ada commit e92eac2

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
33

44
## [Unreleased]
55
### Added
6-
- Added pylint, enforcing `line-too-long` and `invalid-name` ([#590](https://github.com/opensearch-project/opensearch-py/pull/590))
6+
- Added pylint `line-too-long` and `invalid-name` ([#590](https://github.com/opensearch-project/opensearch-py/pull/590))
7+
- Added pylint `pointless-statement` ([#611](https://github.com/opensearch-project/opensearch-py/pull/611))
78
### Changed
89
### Deprecated
910
### Removed

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ good-names-rgxs = ^[_a-z][_a-z0-9]?$ # allow for 1-character variable names
2828

2929
[pylint.MESSAGE CONTROL]
3030
disable = all
31-
enable = line-too-long, invalid-name
31+
enable = line-too-long, invalid-name, pointless-statement

test_opensearchpy/test_async/test_helpers/test_document.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,10 @@ async def test_doc_type_can_be_correctly_pickled() -> None:
343343

344344
async def test_meta_is_accessible_even_on_empty_doc() -> None:
345345
d = MyDoc()
346-
d.meta
346+
assert d.meta == {}
347347

348348
d = MyDoc(title="aaa")
349-
d.meta
349+
assert d.meta == {}
350350

351351

352352
async def test_meta_field_mapping() -> None:
@@ -404,7 +404,7 @@ def password(self, pwd: Any) -> None:
404404
assert u.check_password(b"not-secret")
405405

406406
with raises(AttributeError):
407-
u.password
407+
assert u.password
408408

409409

410410
async def test_nested_can_be_assigned_to() -> None:

test_opensearchpy/test_helpers/test_document.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,10 @@ def test_doc_type_can_be_correctly_pickled() -> None:
353353

354354
def test_meta_is_accessible_even_on_empty_doc() -> None:
355355
d1: Any = MyDoc()
356-
d1.meta
356+
assert d1.meta == {}
357357

358358
d2: Any = MyDoc(title="aaa")
359-
d2.meta
359+
assert d2.meta == {}
360360

361361

362362
def test_meta_field_mapping() -> None:
@@ -414,7 +414,7 @@ def password(self, pwd: Any) -> None:
414414
assert u.check_password(b"not-secret")
415415

416416
with raises(AttributeError):
417-
u.password
417+
assert u.password
418418

419419

420420
def test_nested_can_be_assigned_to() -> None:

test_opensearchpy/test_helpers/test_result.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def agg_response(aggs_search: Any, aggs_data: Any) -> Any:
4343

4444

4545
def test_agg_response_is_pickleable(agg_response: Any) -> None:
46-
agg_response.hits
46+
assert agg_response.hits == []
4747
r = pickle.loads(pickle.dumps(agg_response))
4848

4949
assert r == agg_response
@@ -53,7 +53,7 @@ def test_agg_response_is_pickleable(agg_response: Any) -> None:
5353

5454
def test_response_is_pickleable(dummy_response: Any) -> None:
5555
res = response.Response(Search(), dummy_response)
56-
res.hits
56+
assert res.hits
5757
r = pickle.loads(pickle.dumps(res))
5858

5959
assert r == res
@@ -146,10 +146,10 @@ def test_hits_provide_dot_and_bracket_access_to_attrs(dummy_response: Any) -> No
146146
assert "Honza" == res.hits[2].name.first
147147

148148
with raises(KeyError):
149-
h["not_there"]
149+
assert h["not_there"]
150150

151151
with raises(AttributeError):
152-
h.not_there
152+
assert h.not_there
153153

154154

155155
def test_slicing_on_response_slices_on_hits(dummy_response: Any) -> None:

0 commit comments

Comments
 (0)