Closed edridgedsouza closed 2 years ago
Thanks! I can indeed reproduce this. A fix is ready in #67
And a new release has been pushed with the fix.
Thanks! Does pscript
include a method to check that transpiled js passes tests written pre-transpilation in pytest
or another python based testing suite?
Does pscript include a method to check that transpiled js passes tests written pre-transpilation in pytest or another python based testing suite?
I don't think so, but I'm also not sure if I understand the question :)
I was essentially just trying to see if there's an easy way to see if transpiling a python script with preexisting tests written could also apply the same tests to the resulting js code. Could perhaps be useful for catching edge cases like this if I use pscript again
Ah I see. In pscript most tests are applied in JS. The evalpy()
function used in many tests evaluates Python code in Node by first transpiling and then running it.
Thanks. As I understand it, this means that a good future workflow would be to create test_foo.py
and for every def test_foo()
in python, there should also be a def test_foo_js()
calling evaljs()
on the same code.
I transpiled a python script containing
str.endswith()
to js and realized that the new code gives inaccurate results. Here is the resulting js:When this gets called, it looks like:
_pymeth_endswith.call(string1, string2)
. This gives false positives whenstring2
is one character longer thanstring1
; for example,_pymeth_endswith.call('a', 'bb')
givestrue
.