test: return self from ECKey/ECPubKey functions #16905

pull elichai wants to merge 1 commits into bitcoin:master from elichai:2019-09-self changing 1 files +3 −0
  1. elichai commented at 3:13 PM on September 18, 2019: contributor

    This allows for nice continuous interaction with the test framework instead of doing this to generate a key:

    key = ECKey()
    key.generate()
    

    You can now do:

    key = ECKey().generate()
    

    The same for setting a private/public key.

    This is a small change but I think it helps creating a smaller more understandable tests (especially if it involves a lot of different keys)

  2. Return self from ECKey, ECPubKey functions in test_framework a58f5887b3
  3. DrahtBot added the label Tests on Sep 18, 2019
  4. promag commented at 9:42 AM on September 22, 2019: member

    No strong opinion but in this looks like a lone change, you could actually use the "style".

  5. laanwj commented at 6:58 AM on September 26, 2019: member

    Not sure about this. In my experience, APIs mutating self but also returning it create their own confusion such as 'do I need to use the return value'.

  6. fanquake requested review from sipa on Sep 26, 2019
  7. fanquake commented at 3:14 AM on January 5, 2020: member

    Going to close. Doesn't seem to be agreement with this. I also agree with @laanwj in regards to:

    APIs mutating self but also returning it create their own confusion

  8. fanquake closed this on Jan 5, 2020

  9. DrahtBot locked this on Feb 15, 2022


sipa

Labels

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: 2026-04-17 09:14 UTC

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