Skip to content
This repository has been archived by the owner on May 7, 2023. It is now read-only.

Commit

Permalink
update scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitanwar committed Feb 14, 2018
1 parent 83e13b0 commit 18ffa0e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion scripts/readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ def tagger():
someFile = open("snippets/" + snippet + '.md')
fileData = someFile.read()
codeParts = re.split(codeRe,fileData)
toAppend += codeParts[0] + f'```py{codeParts[1]} \n ```' +codeParts[2] + f'<details><summary>View Examples</summary>\n\n```py\n{codeParts[3]}\n```\n</details>\n\n<br><a href = "#table-of-contents">:arrow_up: Back to top</a>\n ' + '\n'
toAppend += codeParts[0] + '```py{codeParts[1]} \n ```'.format(codeParts= codeParts) +codeParts[2] + '<details><summary>View Examples</summary>\n\n```py\n{codeParts[3]}\n```\n</details>\n\n<br><a href = "#table-of-contents">:arrow_up: Back to top</a>\n '.format(codeParts=codeParts) + '\n'
open("README.md",'w').write(start+toAppend+'\n'+end)
12 changes: 7 additions & 5 deletions scripts/tdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
test_file = open(f'test/{snippet}/{snippet}_test.py','w')
file_to_write_to.write(code)
file_to_write_to.close()
test_file.write(f'''
import pytest,types,functools
test_file.write('''
import types,functools
from tape import test
from {snippet} import {snippet}
def {snippet}_test():
assert isinstance({snippet}, (types.BuiltinFunctionType, types.FunctionType, functools.partial))
'''.strip())
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())
test_file.close()

0 comments on commit 18ffa0e

Please sign in to comment.