Add lots of things(including tests)

This commit is contained in:
Rohit Tanwar
2018-02-16 16:09:18 +05:30
parent c7810b00bb
commit fb9176aa91
51 changed files with 308 additions and 7 deletions

View File

@ -10,15 +10,15 @@ for snippet in snippets:
content = f.read()
code = re.search(codeRe,content).group(1).strip()
file_to_write_to = open(f'test/{snippet}/{snippet}.py','w')
test_file = open(f'test/{snippet}/{snippet}_test.py','w')
test_file = open(f'test/{snippet}/{snippet}.test.py','w')
file_to_write_to.write(code)
file_to_write_to.close()
test_file.write('''
test_file.write(f'''
import types,functools
from tape import test
from {snippet} import {snippet}
def {snippet}_test(t):
t.true(isinstance({snippet}, (types.BuiltinFunctionType, types.FunctionType, functools.partial)),'{snippet} is a function')
test('Testing {snippet}',{snippet}_test)
'''.format(snippet = snippet).strip())
'''.strip())
test_file.close()