Closed rcxwhiz closed 4 months ago
I've got a drawing of 32 nodes and how I would like to assemble them for testing. I'll use these to add some extended tests to the test suite.
I'm realizing that for these tests to be deterministic, there will need to be a parameter added to the children
method (and the direct_children
method) so that the order the children get chosen in can be set.
At that point it might be worth it to pass in a lambda parameter so you can transform the queryset to your liking? Not just with a call to order_by
.
I should also probably take off the name fields from the test model and just put in an integer field so I can identify the models. That reminds me that I also might have to define __eq__
on HierarchicalModel.Node
so that I can assert that trees of children are equal.
Got the argument added to the get children stuff so that you can specify the order that you get children in.
Got the test model switch to an integer field instead of name fields.
Because each of the models should be implementing the same
HierarchicalModel
interface, I should be able to make some sort ofTestCase
mixin thing, like thisAlthough due to migrations I might possibly need to replace
[AdjacencyListModel]
with[SomeAdjacencyListModelSubclass]
.