def test_literals(self): # these work with require: self.exec_js(js(10)) == 10 self.exec_js(js("i am a cow")) == "i am a cow" # these literals are buggy, and it seems to be PJs' fault # ??? all the results seem to turn into strings ??? with require: self.exec_js(js(3.14)) == str(3.14) self.exec_js(js([1, 2, 'lol'])) == str([1, 2, 'lol']) self.exec_js(js({"moo": 2, "cow": 1})) == str({"moo": 2, "cow": 1})
def test_executions(self): with require: self.exec_js(js((lambda x: x * 2)(10))) == 20 self.exec_js(js(sum([x for x in range(10) if x > 5]))) == 30