As requested in #631 and also #1349; this change should cause the tests (and
also the examples from the docs directory which get pulled into the tests)
to be pulled into the sdist.
With this change I can:
- `poetry build`
- Grab and extract the resulting tarball
- `poetry install --extras dev` inside the resulting directory
- `poetry run pytest -vv tests` inside the resulting directory
As I understand the request, I think this should provide everything
necessary.
NOTE: We have spoken about rolling the CLI tools into snapshot tests too, so
if that happens we should remember to make sure that the pipeline outlined
above still works fine.
After some internal discussion we've decided to keep `Tree.clear` as it was,
and add a `Tree.reset`, which does a `Tree.clear` but resets the label and
data of `Tree.root` to the values given, while mirroring how `Tree.__init__`
takes those parameters.
Just before doing the commit I decided to rename the test tree in the new
unit test for clearing down a tree. Of course I managed to name it in such a
way that it becomes special to pytest.
This fixes that.
See #1437 for background. While it would be ideal to allow for the complete
emptying of a Tree, the root node is required (and it's part of the
construction of a Tree). So, here, when clearing the Tree we optionally
allow for a new label to be given.
Ideally we'll also allow for fresh data to be provided too; but there's a
wrinkle there in knowing the difference between the data being None, and no
data being provided (so the current root's data being carried over).
Following the method of defaulting used in __init__ would cause problems. As
such, rather than roll all of this into one commit, this goes with the basic
requirement and the solution for data will follow.
Note this also starts some unit tests for the clearing of a Tree.