Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function calls can include integers and test script #2

Merged
merged 6 commits into from
Jul 25, 2018
Merged

function calls can include integers and test script #2

merged 6 commits into from
Jul 25, 2018

Conversation

kennethgoodman
Copy link
Contributor

test script looks at the input and expected output and checks the difference.

import difflib
from pprint import pprint
try:
from StringIO import StringIO # python 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quoting setup.py
'Programming Language :: Python :: 3 :: Only'

@@ -0,0 +1,46 @@
import os
from rockstarpy.rockstar import convert_code
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PEP8 Imports

rock_files = filter(lambda f: '.rock' == f[-5:], files)
py_files = set(filter(lambda f: '.py' == f[-3:], files))
for rock_file in rock_files:
file_name = rock_file[:-5]
Copy link
Contributor

@deepserket deepserket Jul 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are assuming that all rockstar files uses ".rock" extension, but on the help for the argument "input" there are listed three different extensions (rock|rockstar|lyrics).
I think that rock_file.rstrip('.', 1)[0] is better

edit: actually rock_files contains only files with the ".rock" extension, because are filtered, so now the problem is that rockstar files with other extension aren't tested

file_name = rock_file[:-5]
py_file = file_name + ".py"
assert py_file in py_files, "Did not create a corrosponding expected output for " + file_name + ".rock"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, there is some code that can be improved:

line 24: py_files = set(filter(lambda f: f.endswith('.py'), files))
line 26: file_name = rock_file.rstrip('.', 1)[0]
line 28: assert py_file in py_files, "Did not create a corrosponding expected output for " + rock_file

@yyyyyyyan
Copy link
Owner

Thank you! I'm accepting the PR. I'm planning to add support to Python 2, so soon I'll get back your try/except.

@yyyyyyyan yyyyyyyan merged commit ca073ba into yyyyyyyan:master Jul 25, 2018
@deepserket
Copy link
Contributor

@yanorestes Python2 is going to die soon, why you want to add support for it?
And, if you add the support for Python2, what is the output of the transcompiler? Python2 code or Python3 code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants