def __new__(mcs, name, bases, dict_):

    def _str_to_identifier(string):
        'Convert a string to a valid Python identifier.'
        return re.sub('\\W|^(?=\\d)', '_', string)

    def create_test(filename):
        'Return a new test function.'

        def test_function(self):
            self._run_notebook(filename)
        return test_function
    for filename in NOTEBOOK_FILENAMES:
        test_name = ('test_%s' % _str_to_identifier(filename))
        dict_[test_name] = create_test(filename)
        dict_[test_name].__doc__ = ('Test tutorial "%s"' % filename)
    return type.__new__(mcs, name, bases, dict_)
def __new__(mcs, name, bases, dict_):

    def _str_to_identifier(string):
        'Convert a string to a valid Python identifier.'
        return re.sub('\\W|^(?=\\d)', '_', string)

    def create_test(filename):
        'Return a new test function.'

        def test_function(self):
            self._run_notebook(filename)
        return test_function
    for filename in NOTEBOOK_FILENAMES:
        test_name = ('test_%s' % _str_to_identifier(filename))
        dict_[test_name] = create_test(filename)
        dict_[test_name].__doc__ = ('Test tutorial "%s"' % filename)
    return type.__new__(mcs, name, bases, dict_)