Skip to content
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

Test, fix, and simplify ATR parsing #217

Merged
merged 2 commits into from
Oct 20, 2024

Conversation

kurtmckee
Copy link
Contributor

@kurtmckee kurtmckee commented Oct 20, 2024

Added

  • Add ATR.py test cases. Code coverage of ATR.py is now 100%.
  • Add type annotations to everything in ATR.py.

Changed

  • SmartcardException will be raised if the ATR is less than 2 bytes.

Fixed

  • The ATR checksumOK attribute is now guaranteed to exist. If there is no checksum, checksumOK will be set to None.

    Previously, the attribute would only exist if a checksum existed.

  • The checksum byte will now always be rendered if it exists.

    Previously, if the checksum byte was 0x00, it would not be rendered.

Removed

  • Remove the __main__ code in ATR.py.

    All of the ATRs are present in the test suite.

Deprecated

  • The ATR hasTA/hasTB/hasTC/hasTD attributes are deprecated.

    Users may compare items in the TA/TB/TC/TD attributes to None.

  • The ATR dump() method is deprecated.

    Users may call the new render() method and print the result.

Added
-----

* Add `ATR.py` test cases. Code coverage of `ATR.py` is now 100%.
* Add type annotations to everything in `ATR.py`.

Changed
-------

* `SmartcardException` will be raised if the ATR is less than 2 bytes.

Fixed
-----

* The ATR `checksumOK` attribute is now guaranteed to exist.
  If there is no checksum, `checksumOK` will be set to `None`.

  Previously, the attribute would only exist if a checksum existed.

* The checksum byte will now always be rendered if it exists.

  Previously, if the checksum byte was `0x00`, it would not be rendered.

Removed
-------

* Remove the `__main__` code in `ATR.py`.

  All of the ATRs are present in the test suite.

Deprecated
----------

* The ATR hasTA/hasTB/hasTC/hasTD attributes are deprecated.

  Users may compare items in the TA/TB/TC/TD attributes to `None`.

* The ATR `dump()` method is deprecated.

  Users may call the new `render()` method and print the result.
@coveralls
Copy link

coveralls commented Oct 20, 2024

Coverage Status

coverage: 66.199% (+0.8%) from 65.418%
when pulling 16e140c on kurtmckee:test-atr
into 099a282 on LudovicRousseau:master.

@LudovicRousseau LudovicRousseau merged commit d90ac7f into LudovicRousseau:master Oct 20, 2024
26 checks passed
@kurtmckee kurtmckee deleted the test-atr branch October 21, 2024 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants