mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-09 10:43:19 -05:00
doc: test: suggest multi-line imports in functional test style guide
This commit is contained in:
parent
c012875b9d
commit
4edc689382
2 changed files with 12 additions and 3 deletions
|
@ -28,7 +28,9 @@ don't have test cases for.
|
||||||
could lead to bugs and issues in the test code.
|
could lead to bugs and issues in the test code.
|
||||||
- Use [type hints](https://docs.python.org/3/library/typing.html) in your code to improve code readability
|
- Use [type hints](https://docs.python.org/3/library/typing.html) in your code to improve code readability
|
||||||
and to detect possible bugs earlier.
|
and to detect possible bugs earlier.
|
||||||
- Avoid wildcard imports
|
- Avoid wildcard imports.
|
||||||
|
- If more than one name from a module is needed, use lexicographically sorted multi-line imports
|
||||||
|
in order to reduce the possibility of potential merge conflicts.
|
||||||
- Use a module-level docstring to describe what the test is testing, and how it
|
- Use a module-level docstring to describe what the test is testing, and how it
|
||||||
is testing it.
|
is testing it.
|
||||||
- When subclassing the BitcoinTestFramework, place overrides for the
|
- When subclassing the BitcoinTestFramework, place overrides for the
|
||||||
|
|
|
@ -14,8 +14,15 @@ is testing and *how* it's being tested
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
# Avoid wildcard * imports
|
# Avoid wildcard * imports
|
||||||
from test_framework.blocktools import (create_block, create_coinbase)
|
# Use lexicographically sorted multi-line imports
|
||||||
from test_framework.messages import CInv, MSG_BLOCK
|
from test_framework.blocktools import (
|
||||||
|
create_block,
|
||||||
|
create_coinbase,
|
||||||
|
)
|
||||||
|
from test_framework.messages import (
|
||||||
|
CInv,
|
||||||
|
MSG_BLOCK,
|
||||||
|
)
|
||||||
from test_framework.p2p import (
|
from test_framework.p2p import (
|
||||||
P2PInterface,
|
P2PInterface,
|
||||||
msg_block,
|
msg_block,
|
||||||
|
|
Loading…
Add table
Reference in a new issue