<commit_before>"""
Test for the various mlab source functions.

These tests are higher level than the tests testing directly the
MlabSource subclasses. They are meant to capture errors in the formatting
of the input arguments.
"""
# Author: <NAME> <gael dot varoquaux at normalesup dot org>
# Copyright (c) 2008, Enthought, Inc.
# License: BSD Style.

import unittest
import numpy as np

from mayavi.tools import sources

################################################################################
# `BaseTestSource`
################################################################################
class BaseTestSource(unittest.TestCase):
    def setUp(self):
        return


    def tearDown(self):
        return


    def all_close(self, a, b):
        """ Similar to numpy's allclose, but works also for a=None.
        """
        if None in (a, b):
            self.assert_(a==b)
        else:
            self.assert_(np.allclose(a, a))


    def check_positions(self, source, x, y, z):<commit_msg>BUG: Avoid a comparison of arrays with None.<commit_after>"""
Test for the various mlab source functions.

These tests are higher level than the tests testing directly the
MlabSource subclasses. They are meant to capture errors in the formatting
of the input arguments.
"""
# Author: <NAME> <gael dot varoquaux at normalesup dot org>
# Copyright (c) 2008, Enthought, Inc.
# License: BSD Style.

import unittest
import numpy as np

from mayavi.tools import sources

################################################################################
# `BaseTestSource`
################################################################################
class BaseTestSource(unittest.TestCase):
    def setUp(self):
        return


    def tearDown(self):
        return


    def all_close(self, a, b):
        """ Similar to numpy's allclose, but works also for a=None.
        """
        if a is None or b is None:
            self.assertIsNone(a)
            self.assertIsNone(b)
        else:
            self.assert_(np.allclose(a, a))


    def check_positions(self, source, x, y, z):
{'fraction_non_alphanumeric': 0.22900763358778625, 'fraction_numerical': 0.003816793893129771, 'mean_word_length': 3.598684210526316, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3860548', 'n_tokens_mistral': 568, 'n_tokens_neox': 529, 'n_words': 206}