You are viewing a plain text version of this content. The canonical link for it is here.
Posted to nuvem-commits@incubator.apache.org by js...@apache.org on 2011/06/13 07:49:20 UTC
svn commit: r1135044 - in /incubator/nuvem/trunk/nuvem-parallel:
nuvem/animation.py nuvem/htattrs.py nuvem/htbutton.py nuvem/htcheck.py
nuvem/htimg.py nuvem/htlink.py nuvem/htstyle.py nuvem/pi_.py
nuvem/pixels.py nuvem/timer.py test.py
Author: jsdelfino
Date: Mon Jun 13 07:49:19 2011
New Revision: 1135044
URL: http://svn.apache.org/viewvc?rev=1135044&view=rev
Log:
Add simple HTML generator component implementations.
Added:
incubator/nuvem/trunk/nuvem-parallel/nuvem/animation.py
- copied, changed from r1135043, incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py
incubator/nuvem/trunk/nuvem-parallel/nuvem/htattrs.py
- copied, changed from r1135043, incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py
incubator/nuvem/trunk/nuvem-parallel/nuvem/htbutton.py
incubator/nuvem/trunk/nuvem-parallel/nuvem/htcheck.py
incubator/nuvem/trunk/nuvem-parallel/nuvem/htimg.py
incubator/nuvem/trunk/nuvem-parallel/nuvem/htlink.py
incubator/nuvem/trunk/nuvem-parallel/nuvem/htstyle.py
- copied, changed from r1135043, incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py
incubator/nuvem/trunk/nuvem-parallel/nuvem/pi_.py
- copied, changed from r1135043, incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py
incubator/nuvem/trunk/nuvem-parallel/nuvem/pixels.py
- copied, changed from r1135043, incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py
Modified:
incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py
incubator/nuvem/trunk/nuvem-parallel/test.py
Copied: incubator/nuvem/trunk/nuvem-parallel/nuvem/animation.py (from r1135043, incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py)
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/animation.py?p2=incubator/nuvem/trunk/nuvem-parallel/nuvem/animation.py&p1=incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py&r1=1135043&r2=1135044&rev=1135044&view=diff
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py (original)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/animation.py Mon Jun 13 07:49:19 2011
@@ -15,12 +15,14 @@
# specific language governing permissions and limitations
# under the License.
-def get(r, sec, content):
+def get(r, msec, loop, content):
if r[0:1] == ('setup',):
- s = sec.get(r)
- if s is None or s == 0:
+ ms = msec.get(r)
+ if ms is None or ms == 0:
return ''
- return 'setupIntervalHandler(' + str(int(s)) + ');'
+ l = loop.get(r)
+ lv = -1 if l is True else 0 if l is None or l is False else int(l)
+ return 'setupAnimationHandler(' + str(int(ms)) + ', ' + str(lv) + ');'
return content.get(r)
Copied: incubator/nuvem/trunk/nuvem-parallel/nuvem/htattrs.py (from r1135043, incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py)
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/htattrs.py?p2=incubator/nuvem/trunk/nuvem-parallel/nuvem/htattrs.py&p1=incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py&r1=1135043&r2=1135044&rev=1135044&view=diff
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py (original)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/htattrs.py Mon Jun 13 07:49:19 2011
@@ -15,12 +15,6 @@
# specific language governing permissions and limitations
# under the License.
-def get(r, sec, content):
- if r[0:1] == ('setup',):
- s = sec.get(r)
- if s is None or s == 0:
- return ''
- return 'setupIntervalHandler(' + str(int(s)) + ');'
-
- return content.get(r)
+def get(r, v):
+ return ("'htattrs", v.get(r))
Added: incubator/nuvem/trunk/nuvem-parallel/nuvem/htbutton.py
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/htbutton.py?rev=1135044&view=auto
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/htbutton.py (added)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/htbutton.py Mon Jun 13 07:49:19 2011
@@ -0,0 +1,50 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import string
+
+def get(r, value):
+ v = value.get(r)
+
+ def isList(v):
+ if getattr(v, '__iter__', False) == False:
+ return False
+ if isinstance(v, basestring) or isinstance(v, dict):
+ return False
+ return True
+
+ def isAssoc(v):
+ if not isList(v):
+ return False
+ if len(v) != 2:
+ return False
+ if isinstance(v[0], basestring) and v[0][0:1] == "'":
+ return True
+ return False
+
+ def mkbutton(v):
+ vl = filter(lambda x: not isAssoc(x), v)
+ al = (filter(lambda x: isAssoc(x) and x[0] == "'htattrs", v) + (("'htattrs",()),))[0][1]
+ l = (() if len(vl) == 0 else (("'id", vl[0]), ("'value", vl[0])) if len(vl) == 1 else (("'id", vl[0]), ("'value", vl[1]))) + al
+ if len(l) == 0:
+ return ''
+ satts = string.join(map(lambda x: x[0][1:] + '="' + x[1] + '"', filter(lambda x: x[0] == "'id", l)), ' ')
+ batts = string.join(map(lambda x: x[0][1:] + '="' + x[1] + '"', filter(lambda x: x[0] != "'id", l)), ' ')
+ return '<SPAN {0} class="button"><INPUT type="button" {1} class="graybutton"/></SPAN>'.format(satts, batts)
+
+ return mkbutton(v) if isList(v) and not isAssoc(v) else mkbutton((v,))
+
Added: incubator/nuvem/trunk/nuvem-parallel/nuvem/htcheck.py
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/htcheck.py?rev=1135044&view=auto
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/htcheck.py (added)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/htcheck.py Mon Jun 13 07:49:19 2011
@@ -0,0 +1,51 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import string
+
+def get(r, value):
+ v = value.get(r)
+
+ def isList(v):
+ if getattr(v, '__iter__', False) == False:
+ return False
+ if isinstance(v, basestring) or isinstance(v, dict):
+ return False
+ return True
+
+ def isAssoc(v):
+ if not isList(v):
+ return False
+ if len(v) != 2:
+ return False
+ if isinstance(v[0], basestring) and v[0][0:1] == "'":
+ return True
+ return False
+
+ def mkcheck(v):
+ vl = filter(lambda x: not isAssoc(x), v)
+ al = (filter(lambda x: isAssoc(x) and x[0] == "'htattrs", v) + (("'htattrs",()),))[0][1]
+ l = (() if len(vl) == 0 else (("'id", vl[0]), ("'value", vl[0])) if len(vl) == 1 else (("'id", vl[0]), ("'value", vl[1]))) + al
+ if len(l) == 0:
+ return '';
+ satts = string.join(map(lambda x: x[0][1:] + '="' + x[1] + '"', filter(lambda x: x[0] == "'id", l)), ' ')
+ catts = string.join(map(lambda x: x[0][1:] + '="' + x[1] + '"', filter(lambda x: x[0] != "'id", l)), ' ')
+ text = filter(lambda x: x[0] == "'value", l)[0][1]
+ return '<SPAN {0} class="checkbox"><INPUT type="checkbox" {1}/><SPAN>{2}</SPAN></SPAN>'.format(satts, catts, text)
+
+ return mkcheck(v) if isList(v) and not isAssoc(v) else mkcheck((v,))
+
Added: incubator/nuvem/trunk/nuvem-parallel/nuvem/htimg.py
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/htimg.py?rev=1135044&view=auto
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/htimg.py (added)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/htimg.py Mon Jun 13 07:49:19 2011
@@ -0,0 +1,50 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import string
+
+def get(r, value):
+ v = value.get(r)
+
+ def isList(v):
+ if getattr(v, '__iter__', False) == False:
+ return False
+ if isinstance(v, basestring) or isinstance(v, dict):
+ return False
+ return True
+
+ def isAssoc(v):
+ if not isList(v):
+ return False
+ if len(v) != 2:
+ return False
+ if isinstance(v[0], basestring) and v[0][0:1] == "'":
+ return True
+ return False
+
+ def mkimg(v):
+ vl = filter(lambda x: not isAssoc(x), v)
+ al = (filter(lambda x: isAssoc(x) and x[0] == "'htattrs", v) + (("'htattrs",()),))[0][1]
+ l = (() if len(vl) == 0 else (("'id", vl[0]), ("'src", vl[0])) if len(vl) == 1 else (("'id", vl[0]), ("'src", vl[1]))) + al
+ if len(l) == 0:
+ return ''
+ satts = string.join(map(lambda x: x[0][1:] + '="' + x[1] + '"', filter(lambda x: x[0] == "'id", l)), ' ')
+ iatts = string.join(map(lambda x: x[0][1:] + '="' + x[1] + '"', filter(lambda x: x[0] != "'id", l)), ' ')
+ return '<SPAN {0} class="img"><IMG {1}/></SPAN>'.format(satts, iatts)
+
+ return mkimg(v) if isList(v) and not isAssoc(v) else mkimg((v,))
+
Added: incubator/nuvem/trunk/nuvem-parallel/nuvem/htlink.py
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/htlink.py?rev=1135044&view=auto
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/htlink.py (added)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/htlink.py Mon Jun 13 07:49:19 2011
@@ -0,0 +1,51 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import string
+
+def get(r, value):
+ v = value.get(r)
+
+ def isList(v):
+ if getattr(v, '__iter__', False) == False:
+ return False
+ if isinstance(v, basestring) or isinstance(v, dict):
+ return False
+ return True
+
+ def isAssoc(v):
+ if not isList(v):
+ return False
+ if len(v) != 2:
+ return False
+ if isinstance(v[0], basestring) and v[0][0:1] == "'":
+ return True
+ return False
+
+ def mklink(v):
+ vl = filter(lambda x: not isAssoc(x), v)
+ al = (filter(lambda x: isAssoc(x) and x[0] == "'htattrs", v) + (("'htattrs",()),))[0][1]
+ l = (() if len(vl) == 0 else (("'id", vl[0]), ("'href", vl[0]), ("'value", vl[0])) if len(vl) == 1 else (("'id", vl[0]), ("'href", vl[0]), ("'value", vl[1])) if len(vl) == 2 else (("'id", vl[0]), ("'href", vl[1]), ("'value", vl[2]))) + al
+ if len(l) == 0:
+ return ''
+ satts = string.join(map(lambda x: x[0][1:] + '="' + x[1] + '"', filter(lambda x: x[0] == "'id", l)), ' ')
+ hatts = string.join(map(lambda x: x[0][1:] + '="' + x[1] + '"', filter(lambda x: x[0] != "'id" and x[0] != "'value", l)), ' ')
+ text = filter(lambda x: x[0] == "'value", l)[0][1]
+ return '<SPAN {0} class="link"><A {1}><SPAN>{2}</SPAN></A></SPAN>'.format(satts, hatts, text)
+
+ return mklink(v) if isList(v) and not isAssoc(v) else mklink((v,))
+
Copied: incubator/nuvem/trunk/nuvem-parallel/nuvem/htstyle.py (from r1135043, incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py)
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/htstyle.py?p2=incubator/nuvem/trunk/nuvem-parallel/nuvem/htstyle.py&p1=incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py&r1=1135043&r2=1135044&rev=1135044&view=diff
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py (original)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/htstyle.py Mon Jun 13 07:49:19 2011
@@ -15,12 +15,29 @@
# specific language governing permissions and limitations
# under the License.
-def get(r, sec, content):
- if r[0:1] == ('setup',):
- s = sec.get(r)
- if s is None or s == 0:
- return ''
- return 'setupIntervalHandler(' + str(int(s)) + ');'
+import string
- return content.get(r)
+def get(r, value):
+ v = value.get(r)
+
+ def isList(v):
+ if getattr(v, '__iter__', False) == False:
+ return False
+ if isinstance(v, basestring) or isinstance(v, dict):
+ return False
+ return True
+
+ def isAssoc(v):
+ if not isList(v):
+ return False
+ if len(v) != 2:
+ return False
+ if isinstance(v[0], basestring) and v[0][0:1] == "'":
+ return True
+ return False
+
+ if isList(v):
+ return ("'style", string.join(map(lambda x: (x[0][1:] + ': ' + str(x[1]) + ';') if isAssoc(x) else x, v), ' '))
+
+ return ("'style", v)
Copied: incubator/nuvem/trunk/nuvem-parallel/nuvem/pi_.py (from r1135043, incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py)
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/pi_.py?p2=incubator/nuvem/trunk/nuvem-parallel/nuvem/pi_.py&p1=incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py&r1=1135043&r2=1135044&rev=1135044&view=diff
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py (original)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/pi_.py Mon Jun 13 07:49:19 2011
@@ -15,12 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-def get(r, sec, content):
- if r[0:1] == ('setup',):
- s = sec.get(r)
- if s is None or s == 0:
- return ''
- return 'setupIntervalHandler(' + str(int(s)) + ');'
-
- return content.get(r)
+def get(r):
+ from math import pi
+ return pi
Copied: incubator/nuvem/trunk/nuvem-parallel/nuvem/pixels.py (from r1135043, incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py)
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/pixels.py?p2=incubator/nuvem/trunk/nuvem-parallel/nuvem/pixels.py&p1=incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py&r1=1135043&r2=1135044&rev=1135044&view=diff
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py (original)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/pixels.py Mon Jun 13 07:49:19 2011
@@ -15,12 +15,6 @@
# specific language governing permissions and limitations
# under the License.
-def get(r, sec, content):
- if r[0:1] == ('setup',):
- s = sec.get(r)
- if s is None or s == 0:
- return ''
- return 'setupIntervalHandler(' + str(int(s)) + ');'
-
- return content.get(r)
+def get(r, n):
+ return '{0:g}px'.format(n.get(r))
Modified: incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py?rev=1135044&r1=1135043&r2=1135044&view=diff
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py (original)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/timer.py Mon Jun 13 07:49:19 2011
@@ -15,12 +15,12 @@
# specific language governing permissions and limitations
# under the License.
-def get(r, sec, content):
+def get(r, msec, content):
if r[0:1] == ('setup',):
- s = sec.get(r)
- if s is None or s == 0:
+ ms = msec.get(r)
+ if ms is None or ms == 0:
return ''
- return 'setupIntervalHandler(' + str(int(s)) + ');'
+ return 'setupIntervalHandler(' + str(int(ms)) + ');'
return content.get(r)
Modified: incubator/nuvem/trunk/nuvem-parallel/test.py
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/test.py?rev=1135044&r1=1135043&r2=1135044&view=diff
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/test.py (original)
+++ incubator/nuvem/trunk/nuvem-parallel/test.py Mon Jun 13 07:49:19 2011
@@ -87,6 +87,13 @@ from nuvem import lowercase
from nuvem import uppercase
from nuvem import format_
from nuvem import parse
+from nuvem import htattrs
+from nuvem import htimg
+from nuvem import htlink
+from nuvem import htbutton
+from nuvem import htcheck
+from nuvem import htstyle
+from nuvem import pixels
from nuvem import eval_
from nuvem import exec_
@@ -204,6 +211,30 @@ def testText():
assert parse.get((), mkref('e', lambda r: r'(\w+) (\w+)'), mkref('s', lambda r: 'a b c')) == ('a', 'b')
return True
+def testAnimation():
+ assert htattrs.get((), mkref('value', lambda r: ("'value", 'abc'))) == ("'htattrs", ("'value", 'abc'))
+ assert htimg.get((), mkref('value', lambda r: 'http://abc.png')) == '<SPAN id="http://abc.png" class="img"><IMG src="http://abc.png"/></SPAN>'
+ assert htimg.get((), mkref('value', lambda r: ('i1', 'http://abc.png'))) == '<SPAN id="i1" class="img"><IMG src="http://abc.png"/></SPAN>'
+ assert htimg.get((), mkref('value', lambda r: ("'htattrs", (("'id", 'i1'), ("'src", 'http://abc.png'), ("'x", 'X'))))) == '<SPAN id="i1" class="img"><IMG src="http://abc.png" x="X"/></SPAN>'
+ assert htimg.get((), mkref('value', lambda r: (("'htattrs", (("'id", 'i1'), ("'src", 'http://abc.png'), ("'x", 'X'))),))) == '<SPAN id="i1" class="img"><IMG src="http://abc.png" x="X"/></SPAN>'
+ assert htlink.get((), mkref('value', lambda r: ('http://abc'))) == '<SPAN id="http://abc" class="link"><A href="http://abc"><SPAN>http://abc</SPAN></A></SPAN>'
+ assert htlink.get((), mkref('value', lambda r: ('http://abc', 'abc'))) == '<SPAN id="http://abc" class="link"><A href="http://abc"><SPAN>abc</SPAN></A></SPAN>'
+ assert htlink.get((), mkref('value', lambda r: ('h1', 'http://abc', 'abc'))) == '<SPAN id="h1" class="link"><A href="http://abc"><SPAN>abc</SPAN></A></SPAN>'
+ assert htlink.get((), mkref('value', lambda r: ("'htattrs", (("'id", 'h1'), ("'href", 'http://abc'), ("'value", 'abc'), ("'x", "X"))))) == '<SPAN id="h1" class="link"><A href="http://abc" x="X"><SPAN>abc</SPAN></A></SPAN>'
+ assert htlink.get((), mkref('value', lambda r: (("'htattrs", (("'id", 'h1'), ("'href", 'http://abc'), ("'value", 'abc'), ("'x", "X"))),))) == '<SPAN id="h1" class="link"><A href="http://abc" x="X"><SPAN>abc</SPAN></A></SPAN>'
+ assert htbutton.get((), mkref('value', lambda r: ('abc'))) == '<SPAN id="abc" class="button"><INPUT type="button" value="abc" class="graybutton"/></SPAN>'
+ assert htbutton.get((), mkref('value', lambda r: ('b1', 'abc'))) == '<SPAN id="b1" class="button"><INPUT type="button" value="abc" class="graybutton"/></SPAN>'
+ assert htbutton.get((), mkref('value', lambda r: ("'htattrs", (("'id", 'b1'), ("'value", 'abc'), ("'x", 'X'))))) == '<SPAN id="b1" class="button"><INPUT type="button" value="abc" x="X" class="graybutton"/></SPAN>'
+ assert htbutton.get((), mkref('value', lambda r: (("'htattrs", (("'id", 'b1'), ("'value", 'abc'), ("'x", 'X'))),))) == '<SPAN id="b1" class="button"><INPUT type="button" value="abc" x="X" class="graybutton"/></SPAN>'
+ assert htcheck.get((), mkref('value', lambda r: 'abc')) == '<SPAN id="abc" class="checkbox"><INPUT type="checkbox" value="abc"/><SPAN>abc</SPAN></SPAN>'
+ assert htcheck.get((), mkref('value', lambda r: ('c1', 'abc'))) == '<SPAN id="c1" class="checkbox"><INPUT type="checkbox" value="abc"/><SPAN>abc</SPAN></SPAN>'
+ assert htcheck.get((), mkref('value', lambda r: ("'htattrs", (("'id", 'c1'), ("'value", 'abc'), ("'x", 'X'))))) == '<SPAN id="c1" class="checkbox"><INPUT type="checkbox" value="abc" x="X"/><SPAN>abc</SPAN></SPAN>'
+ assert htcheck.get((), mkref('value', lambda r: (("'htattrs", (("'id", 'c1'), ("'value", 'abc'), ("'x", 'X'))),))) == '<SPAN id="c1" class="checkbox"><INPUT type="checkbox" value="abc" x="X"/><SPAN>abc</SPAN></SPAN>'
+ assert htstyle.get((), mkref('value', lambda r: (("'width", '320px'), ("'height", '460px')))) == ("'style", 'width: 320px; height: 460px;')
+ assert htstyle.get((), mkref('value', lambda r: ('width: 320px;', ("'height", '460px')))) == ("'style", 'width: 320px; height: 460px;')
+ assert pixels.get((), mkref('value', lambda r: 320.0)) == '320px'
+ return True
+
def testEval():
assert eval_.get((), mkref('py', lambda r: '1 + 2'), mkref('ref', lambda r: 4)) == 3
assert eval_.get((), mkref('py', lambda r: 'ref.get(r) + 2'), mkref('ref', lambda r: 4)) == 6
@@ -222,6 +253,7 @@ if __name__ == '__main__':
testMath()
testHTTP()
testText()
+ testAnimation()
testEval()
print 'OK'