LettError/MutatorMath

Test failure in `objects/mutator.py`

Closed this issue · 2 comments

On Python 3 there is a test failure in mutator.py, because the order of the axis names being returned is different if the same test is run on Python 2. Mutator.getAxisNames() is creating a list of axis names like this:

        s = {}
        for l, x in self.items():
            s.update(dict.fromkeys([k for k, v in l], None))
        return list(s.keys())

In other words, the test is relying on the order given by list() on the unordered set of dictionary keys. Given that this list of axis names is later used only by Location.expand(), and that each item of the list is used as keys on a dictionary, which is a set… they should probably just be a set from the beginning.

Original Traceback below:

**********************************************************************
File "Lib/mutatorMath/objects/mutator.py", line 589, in __main__.test_methods
Failed example:
    m.getAxisNames()
Expected:
    ['snap', 'pop']
Got:
    ['pop', 'snap']
**********************************************************************
1 items had failures:
   1 of   2 in __main__.test_methods
***Test Failed*** 1 failures.

Again, I have a fix on hand for this issue, pull request following shortly.

Hey Antonio, I'm happy to see you here :)
Yes, Python 3 support in MutatorMath is still a bit lacking.
Thanks for helping improving it!

I think moving forward we should try to convert all the current doctests to unittest or pytest tests.
I think @moyogo started to work on it at some point, but I'm not sure if he's completed this.

I have been working on the unit tests too, I have a patch to at least be able to run all the current tests as soon as possible. Travis test passing and coverage reports are very inaccurate right now because the test suite is not being run almost at all.