-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PyPDF4/filters.py unit tests #9
Conversation
Too many and too little to document them all.
Very small changes were added elsewhere too.
`str_()` is now `pypdfStr()`, `ord_()` is `pypdfOrd()`, `b_()` is `pypdfBytes()` and so on. In case a user wishes to retain the old names, such functions can be imported as ``` from PyPDF4.utils import pypdfStr as str_, pypdfBytes as b_ # ... ```
The `staticmethod()` feature was first added in version 2.2 of Python, with the decorator syntax being added in 2.4: [source](https://docs.python.org/2.7/library/functions.html#staticmethod).
`pypdfOrd()` in `PyPDF4/utils.py` was updated too.
This version of the encoder is primarily meant to aid testing of `LZWDecode.Decoder`. It does not interpret optional parameters and may contain a few bugs as of this commit.
Commit 169dce1 should end issue #8. There's only one |
An encode() method had to be added in ASCII85Decode specifically for testing purposes. A bug in the Python 2 implementation of ASCII85Decode.decode() was potentially found.
Hey @claird, isn't it possible to set Pylint flags such as these in the source code:
in the configuration of the Pylint tool? I will check myself, and if you agree will weed out those invasive comment declarations. |
Pylint indeed respects a .pylintrc.
As I understand .pylintrc, if I mention too-few-public-methods there, it
will turn off that check for *all* methods. I want to leave the checks on
for at least a while longer. I understand your point that static methods
don't deserve the stigma of a source #pylint declaration. While I suspect
there's a good solution for that issue, I haven't researched it yet.
Cameron Laird, vice president
We make computers work for people.
…On Fri, Aug 24, 2018 at 6:45 AM, Oscar ***@***.***> wrote:
Hey @claird <https://github.com/claird>, isn't it possible to set Pylint
flags such as these in the source code:
class CCITTFaxDecode(object): # pylint: disable=too-few-public-methods
@staticmethod
in the configuration of the Pylint tool? I will check myself, and if you
agree will weed out those invasive comment declarations.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#9 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAbN9KZCQV8zzCeiqe6SHUUPADh3FXNrks5uT_WAgaJpZM4WISzQ>
.
|
… 2 and 3. The bug manifested solely in the Python 2 version of the code, which has been deleted now (sorry, but it's a little cumbersome to maintain **two** distinct implementations of an algorithm at once - the one stored now is efficient and works seamlessly for both Python 2 and Python 3!). TO-DO: the current decode() algorithm doesn't verify the ending `~>` EOD sequence in an ASCII85-encoded sequence.
These should be considered "scratching scripts" for now, so not a lot of development time was spent on them. However, it was ensured that they work properly, like not they were doing before.
I had been prolonging |
One unit test was added to ensure that these many tweaks didn't introduce any changes in a specific area (@Property and such).
I am noting that GitHub doesn't allow reopening PRs that were just merged. Will need to find a workaround or just resort to opening a new one each time. |
Thank you, newnone, for your contributions and patience. |
This is an ongoing PR - do not close it right after the first merge, I will continue pushing more until I say I am done with it. In the meantime, review and eventually merge the existng code.
I have continued adding unit tests for filters in
PyPDF4/filters.py
, and admittedly they turned out quite useful in estirpating a few bugs or refactoring some algorithms. As of now, I'm not fully sure thatLZWDecode.Decoder
is bug-free as I found it in the codebase prior to working on it; indeed, one of its test cases keeps failing.There were also a few other commits not fully related to unit testing, but they were good enough to be added.