def add_tests():
    for example in EXAMPLES:
        def create_test(ex):
            """Create a test
            """
            def test(self):
                """Test the example
                """
                stdout_filename = ('./tests/example_outputs/' +
                                   format_example_name(ex)) + '.out'
                stderr_filename = ('./tests/example_outputs/' +
                                   format_example_name(ex)) + '.err'
                self.assertTrue(os.path.isfile(stdout_filename),
                                "Cannot find file with expected output "
                                "'%s'" % stdout_filename)
                with open(stdout_filename, 'r') as f_handle:
                    expected_stdout = f_handle.read()
                self.assertTrue(os.path.isfile(stderr_filename),
                                "Cannot find file with expected output "
                                "'%s'" % stderr_filename)
                with open(stdout_filename, 'r') as f_handle:
                    expected_stdout = f_handle.read()
                with open(stderr_filename, 'r') as f_handle:
                    expected_stderr = f_handle.read()
                self.check_shell(ex, expected_stdout, expected_stderr)

            return test

        setattr(TestExamples,
                'test_' + format_example_name(example),
                create_test(example))
Creates the tests and adds them to the ExampleTest
dataset/ETHPy150Open duerrp/pyexperiment/tests/test_examples.py/add_tests