Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mathTransform] what's the purpose of test_functions unit test? #35

Open
anthrotype opened this issue Nov 1, 2016 · 5 comments
Open

Comments

@anthrotype
Copy link
Member

It's not clear to me what the purpose of test_mathTransform.py::MathTransformTest.test_functions is.

It seems to assert that at least for some of the _testData, the three testFunctions yield slightly different results.

However:

  • only the results of the first and second functions are compared, the third seems to be ignored;
  • the assertion is too broad and catch-all: it's not very useful to know that sometimes given some random interpolation values results may be different. I would like to know when, how different and why.

Another problem is that since the interpolation value is random.random(), sometimes the test can unpredictably fail (i.e. FontMathWarning is never raised, all results are same between functions), for example:

https://travis-ci.org/typesupply/fontMath/jobs/172252357#L356

I think we need to narrow this test down a little bit, though I'm not sure how.

Maybe @typesupply or @moyogo can shed some light?

def test_functions(self):
        """
        In this test various complex transformations are interpolated using
        3 different methods:
          - straight linear interpolation, the way glyphMath does it now.
          - using the MathTransform interpolation method.
          - using the ShallowTransform with an initial decompose and final
            compose.
        """
        value = random()
        testFunctions = [
            _polarDecomposeInterpolationTransformation,
            _mathPolarDecomposeInterpolationTransformation,
            _linearInterpolationTransformMatrix,
        ]
        with self.assertRaisesRegex(
                FontMathWarning,
                "Minor differences occured when "
                "comparing the interpolation functions."):
            for i, m in enumerate(_testData):
                m1, m2 = m
                results = []
                for func in testFunctions:
                    r = func(m1, m2, value)
                    results.append(r)
                if not results[0] == results[1]:
                    raise FontMathWarning(
                        "Minor differences occured when "
                        "comparing the interpolation functions.")
@anthrotype
Copy link
Member Author

@typesupply I'm going to temporarily disable this test, as it risks making the whole CI build fail in random fashion (not nice while you're tagging a release).
Could you have a look at some point? I don't understand the purpose of this test...
Thank you.

@typesupply
Copy link
Member

I don't know anything about this functionality. Sorry. I think @LettError added it here: 4a1f0fc Erik, any advice?

@anthrotype
Copy link
Member Author

Ok thanks Tal.

@LettError
Copy link
Member

LettError commented Jan 27, 2017 via email

@anthrotype
Copy link
Member Author

I have disabled the intermittently failing test_functions test with commit 21b8bb8.

E.g. see one recent Travis build failure caused by that: https://travis-ci.org/typesupply/fontMath/builds/279556453

I don't have the time to investigate right now. I think it's better to disable it until somebody figures out how to properly fix it.

Very low priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants