

def test_check_exists():
    try:
        directory = tempfile.mkdtemp()
        with open(os.path.join(e, 'abcdef.txt'), 'w') as f:
            print('\n', file=f)

        @check_exists(required_files=['abcdef.txt'])
        def foo(directory, a=None, b=None):
            pass
        try:
            foo(directory)
        except MissingInputFiles:
            assert False, 'MissingInputFiles raised when files present'

        @check_exists(required_files=['ghijkl.txt'])
        def bar(directory, c=None, d=None):
            pass
        assert_raises(MissingInputFiles, bar, directory)

        @check_exists(required_files=['abcdef.txt', 'ghijkl.txt'])
        def baz(directory, x, y=None):
            pass
        assert_raises(MissingInputFiles, baz, directory, 9)
        try:
            baz(directory, 9)
        except MissingInputFiles as e:
            assert (e.filenames == ['ghijkl.txt'])
        with open(os.path.join(directory, 'ghijkl.txt'), 'w') as f:
            print('\n\n', file=f)
        try:
            bar(directory)
            baz(directory, 44)
        except MissingInputFiles:
            assert False, 'MissingInputFiles raised when files present'
    finally:
        os.remove(os.path.join(directory, 'abcdef.txt'))
        os.remove(os.path.join(directory, 'ghijkl.txt'))
        os.rmdir(directory)

dataset/ETHPy150Open mila-udem/fuel/tests/test_converters.py test_check_exists/VarMisuse@30/34 `directory`->`e`