Enabled pylint:pointless-statement. (#611)

Signed-off-by: dblock <[email protected]>
This commit is contained in:
Daniel (dB.) Doubrovkine
2023-11-21 12:55:24 -08:00
committed by GitHub
parent 1801ada270
commit e92eac2c82
5 changed files with 13 additions and 12 deletions
+2 -1
View File
@@ -3,7 +3,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
## [Unreleased] ## [Unreleased]
### Added ### Added
- Added pylint, enforcing `line-too-long` and `invalid-name` ([#590](https://github.com/opensearch-project/opensearch-py/pull/590)) - Added pylint `line-too-long` and `invalid-name` ([#590](https://github.com/opensearch-project/opensearch-py/pull/590))
- Added pylint `pointless-statement` ([#611](https://github.com/opensearch-project/opensearch-py/pull/611))
### Changed ### Changed
### Deprecated ### Deprecated
### Removed ### Removed
+1 -1
View File
@@ -28,4 +28,4 @@ good-names-rgxs = ^[_a-z][_a-z0-9]?$ # allow for 1-character variable names
[pylint.MESSAGE CONTROL] [pylint.MESSAGE CONTROL]
disable = all disable = all
enable = line-too-long, invalid-name enable = line-too-long, invalid-name, pointless-statement
@@ -343,10 +343,10 @@ async def test_doc_type_can_be_correctly_pickled() -> None:
async def test_meta_is_accessible_even_on_empty_doc() -> None: async def test_meta_is_accessible_even_on_empty_doc() -> None:
d = MyDoc() d = MyDoc()
d.meta assert d.meta == {}
d = MyDoc(title="aaa") d = MyDoc(title="aaa")
d.meta assert d.meta == {}
async def test_meta_field_mapping() -> None: async def test_meta_field_mapping() -> None:
@@ -404,7 +404,7 @@ async def test_docs_with_properties() -> None:
assert u.check_password(b"not-secret") assert u.check_password(b"not-secret")
with raises(AttributeError): with raises(AttributeError):
u.password assert u.password
async def test_nested_can_be_assigned_to() -> None: async def test_nested_can_be_assigned_to() -> None:
@@ -353,10 +353,10 @@ def test_doc_type_can_be_correctly_pickled() -> None:
def test_meta_is_accessible_even_on_empty_doc() -> None: def test_meta_is_accessible_even_on_empty_doc() -> None:
d1: Any = MyDoc() d1: Any = MyDoc()
d1.meta assert d1.meta == {}
d2: Any = MyDoc(title="aaa") d2: Any = MyDoc(title="aaa")
d2.meta assert d2.meta == {}
def test_meta_field_mapping() -> None: def test_meta_field_mapping() -> None:
@@ -414,7 +414,7 @@ def test_docs_with_properties() -> None:
assert u.check_password(b"not-secret") assert u.check_password(b"not-secret")
with raises(AttributeError): with raises(AttributeError):
u.password assert u.password
def test_nested_can_be_assigned_to() -> None: def test_nested_can_be_assigned_to() -> None:
@@ -43,7 +43,7 @@ def agg_response(aggs_search: Any, aggs_data: Any) -> Any:
def test_agg_response_is_pickleable(agg_response: Any) -> None: def test_agg_response_is_pickleable(agg_response: Any) -> None:
agg_response.hits assert agg_response.hits == []
r = pickle.loads(pickle.dumps(agg_response)) r = pickle.loads(pickle.dumps(agg_response))
assert r == agg_response assert r == agg_response
@@ -53,7 +53,7 @@ def test_agg_response_is_pickleable(agg_response: Any) -> None:
def test_response_is_pickleable(dummy_response: Any) -> None: def test_response_is_pickleable(dummy_response: Any) -> None:
res = response.Response(Search(), dummy_response) res = response.Response(Search(), dummy_response)
res.hits assert res.hits
r = pickle.loads(pickle.dumps(res)) r = pickle.loads(pickle.dumps(res))
assert r == res assert r == res
@@ -146,10 +146,10 @@ def test_hits_provide_dot_and_bracket_access_to_attrs(dummy_response: Any) -> No
assert "Honza" == res.hits[2].name.first assert "Honza" == res.hits[2].name.first
with raises(KeyError): with raises(KeyError):
h["not_there"] assert h["not_there"]
with raises(AttributeError): with raises(AttributeError):
h.not_there assert h.not_there
def test_slicing_on_response_slices_on_hits(dummy_response: Any) -> None: def test_slicing_on_response_slices_on_hits(dummy_response: Any) -> None: