import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "../test/testsuite/lib/pyxl/")) from pyxl.codec.register import pyxl_transform_string for i in xrange(100): # pyxl/tests/test_if_1.py pyxl_transform_string( ''' from pyxl import html def test(): assert str(<frag><if cond="{True}">true</if><else>false</else></frag>) == "true" assert str(<frag><if cond="{False}">true</if><else>false</else></frag>) == "false" ''') for i in xrange(100): # pyxl/tests/test_curlies_in_attrs_1.py pyxl_transform_string( ''' from pyxl import html def test(): # kannan thinks this should be different assert str(<frag><img src="{'foo'}" /></frag>) == """<img src="foo" />""" ''') for i in xrange(100):
import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "lib/pyxl/")) from pyxl.codec.register import pyxl_transform_string for i in xrange(1000): # pyxl/tests/test_if_1.py pyxl_transform_string( ''' from pyxl import html def test(): assert str(<frag><if cond="{True}">true</if><else>false</else></frag>) == "true" assert str(<frag><if cond="{False}">true</if><else>false</else></frag>) == "false" ''') for i in xrange(1000): # pyxl/tests/test_curlies_in_attrs_1.py pyxl_transform_string( ''' from pyxl import html def test(): # kannan thinks this should be different assert str(<frag><img src="{'foo'}" /></frag>) == """<img src="foo" />""" ''') for i in xrange(1000):
import sys, os sys.path.append(os.path.join(os.path.dirname(__file__), "lib/pyxl/")) s = """ #coding: pyxl from pyxl import html, rss channel = ( <frag> <rss.rss_decl_standalone /> <rss.rss version="2.0"> <rss.channel> <rss.title>A Title</rss.title> <rss.link>https://www.dropbox.com</rss.link> <rss.description>A detailed description</rss.description> <rss.ttl>60</rss.ttl> <rss.language>en-us</rss.language> </rss.channel> </rss.rss> </frag> ) for i in xrange(60000): channel.to_string() """ from pyxl.codec.register import pyxl_transform_string t = pyxl_transform_string(s) exec s
sys.path.append(os.path.join(os.path.dirname(__file__), "lib/pyxl/")) s = """ #coding: pyxl from pyxl import html, rss channel = ( <frag> <rss.rss_decl_standalone /> <rss.rss version="2.0"> <rss.channel> <rss.title>A Title</rss.title> <rss.link>https://www.dropbox.com</rss.link> <rss.description>A detailed description</rss.description> <rss.ttl>60</rss.ttl> <rss.language>en-us</rss.language> </rss.channel> </rss.rss> </frag> ) for i in xrange(60000): channel.to_string() """ from pyxl.codec.register import pyxl_transform_string t = pyxl_transform_string(s) exec s
def p(tree): new_string = pyxl_transform_string("(" + tree.s + ")") new_tree = ast.parse("from __future__ import unicode_literals;" + new_string) return new_tree.body[1].value
def p(tree): new_string = pyxl_transform_string('(' + tree.s + ')') new_tree = ast.parse("from __future__ import unicode_literals;" + new_string) return new_tree.body[1].value