-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
pylint-dev/astroid
#807Labels
Description
Steps to reproduce
- File
test_bytes.py
class Sample:
# warns about E0308: invalid-bytes-returned
def __bytes__(self):
return "hey".encode('utf-8')
# will print <class 'bytes'>
print(type(bytes(Sample())))- pylint it.
$ python test_bytes.py
<class 'bytes'>
$ pylint test_bytes.py
************* Module test_bytes
test_bytes.py:1:0: C0114: Missing module docstring (missing-module-docstring)
test_bytes.py:1:0: C0114: Missing module docstring (missing-module-docstring)
test_bytes.py:1:0: C0115: Missing class docstring (missing-class-docstring)
test_bytes.py:4:4: E0308: __bytes__ does not return bytes (invalid-bytes-returned)
test_bytes.py:1:0: R0903: Too few public methods (1/2) (too-few-public-methods)
-------------------------------------
Your code has been rated at -10.00/10
Current behavior
I get an E0308.
Expected behavior
Not to get an E03008.
pylint --version output
pylint 2.5.2
astroid 2.4.1
Python 3.7.7 (default, Mar 23 2020, 11:12:08)
[GCC 9.3.0]
horta