test: refactor: remove hex_str_to_bytes helper #22593

pull theStack wants to merge 1 commits into bitcoin:master from theStack:202107-test-remove_unneeded_hexstrtobytes changing 15 files +40 −57
  1. theStack commented at 7:37 pm on July 31, 2021: member

    Use the built-in class method bytes.fromhex() instead, which is available since Python 3.0 (https://docs.python.org/3.0/library/stdtypes.html?highlight=fromhex#bytes.fromhex).

    This would be nice to solve with a scripted-diff, but it’s tricky to also tackle the imports (which need to be removed in the same commit, otherwise the linter would complain).

  2. MarcoFalke deleted a comment on Jul 31, 2021
  3. DrahtBot added the label Tests on Jul 31, 2021
  4. practicalswift commented at 8:41 pm on July 31, 2021: contributor
    Concept ACK
  5. Zero-1729 approved
  6. Zero-1729 commented at 10:02 pm on July 31, 2021: contributor
    Concept and code review ACK ee54626838f014efa9cc858df28e717327075565
  7. DrahtBot commented at 1:08 am on August 1, 2021: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    No conflicts as of last run.

  8. DrahtBot added the label Needs rebase on Aug 1, 2021
  9. test: refactor: remove `hex_str_to_bytes` helper
    Use the built-in class method bytes.fromhex() instead,
    which is available since Python 3.0.
    ca6c154ef1
  10. theStack force-pushed on Aug 1, 2021
  11. theStack commented at 5:35 pm on August 1, 2021: member

    Rebased on master due to conflict after merge of #22429.

    For the previous ACK (thanks Zero-1729!), it can be trivially re-reviewed via git range-diff ee5462683...ca6c154ef

  12. DrahtBot removed the label Needs rebase on Aug 1, 2021
  13. Zero-1729 approved
  14. Zero-1729 commented at 8:09 pm on August 1, 2021: contributor
    re-ACK ca6c154ef116e8d2e0484cdb1af13b34a0c86c17, clean rebase.
  15. practicalswift commented at 8:16 pm on August 1, 2021: contributor
    cr ACK ca6c154ef116e8d2e0484cdb1af13b34a0c86c17
  16. tryphe commented at 8:32 am on August 2, 2021: contributor

    Concept ACK, cr ACK ca6c154ef116e8d2e0484cdb1af13b34a0c86c17

    Silly question, shouldn’t we also test bytes.fromhex()? Or maybe not if there’s enough constants checked in other places.

  17. MarcoFalke merged this on Aug 2, 2021
  18. MarcoFalke closed this on Aug 2, 2021

  19. laanwj commented at 10:15 am on August 2, 2021: member
    FWIW unhexlify can take str as well. There was already no need for the encode(). Though I guess using a built-in is slightly better.
  20. MarcoFalke commented at 10:34 am on August 2, 2021: member
    I slightly prefer the clear bytes.fromhex name over the cryptic a2b_hex or the negation unhexlify. In any case it could make sense to remove the a2b_hex and unhexlify uses. It doesn’t really make sense to use four different ways (three after this pull), sometimes even mixed within the same file, to achieve the same outcome.
  21. theStack deleted the branch on Aug 2, 2021
  22. sidhujag referenced this in commit 0ca1dd9f99 on Aug 4, 2021
  23. MarcoFalke referenced this in commit f4328ebef5 on Aug 5, 2021
  24. MarcoFalke referenced this in commit f5a406f003 on Aug 21, 2021
  25. Fabcien referenced this in commit f19bc27b60 on Mar 7, 2022
  26. DrahtBot locked this on Aug 18, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-09-29 01:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me