[pypy-svn] r36681 - in pypy/dist/pypy/translator/js/modules: . test

fijal at codespeak.net fijal at codespeak.net
Sat Jan 13 18:14:12 CET 2007


Author: fijal
Date: Sat Jan 13 18:14:07 2007
New Revision: 36681

Modified:
   pypy/dist/pypy/translator/js/modules/dom.py
   pypy/dist/pypy/translator/js/modules/test/test_dom.py
Log:
Wack test_dom and dom until it passes


Modified: pypy/dist/pypy/translator/js/modules/dom.py
==============================================================================
--- pypy/dist/pypy/translator/js/modules/dom.py	(original)
+++ pypy/dist/pypy/translator/js/modules/dom.py	Sat Jan 13 18:14:07 2007
@@ -24,6 +24,9 @@
 from pypy.translator.stackless.test.test_transform import one
 from xml.dom import minidom
 
+from pypy.annotation.signature import annotation
+from pypy.annotation import model as annmodel
+
 # EventTarget is the base class for Nodes and Window
 class EventTarget(BasicExternal):
     def addEventListener(self, type, listener, useCapture):
@@ -311,377 +314,382 @@
 
 # rtyper stuff
 
+def _callable(args, result=None):
+    return annmodel.SomeGenericCallable([annotation(i) for i in args],
+                                         annotation(result))
+
 EventTarget._fields = {
-    'onabort' : MethodDesc([Event()]),
-    'onblur' : MethodDesc([Event()]),
-    'onchange' : MethodDesc([Event()]),
-    'onclick' : MethodDesc([MouseEvent()]),
-    'onclose' : MethodDesc([MouseEvent()]),
-    'ondblclick' : MethodDesc([MouseEvent()]),
-    'ondragdrop' : MethodDesc([MouseEvent()]),
-    'onerror' : MethodDesc([MouseEvent()]),
-    'onfocus' : MethodDesc([Event()]),
-    'onkeydown' : MethodDesc([KeyEvent()]),
-    'onkeypress' : MethodDesc([KeyEvent()]),
-    'onkeyup' : MethodDesc([KeyEvent()]),
-    'onload' : MethodDesc([KeyEvent()]),
-    'onmousedown' : MethodDesc([MouseEvent()]),
-    'onmousemove' : MethodDesc([MouseEvent()]),
-    'onmouseup' : MethodDesc([MouseEvent()]),
-    'onmouseover' : MethodDesc([MouseEvent()]),
-    'onmouseup' : MethodDesc([MouseEvent()]),
-    'onresize' : MethodDesc([Event()]),
-    'onscroll' : MethodDesc([MouseEvent()]),
-    'onselect' : MethodDesc([MouseEvent()]),
-    'onsubmit' : MethodDesc([MouseEvent()]),
-    'onunload' : MethodDesc([Event()]),
+    'onabort' : _callable([Event]),
+    'onblur' : _callable([Event]),
+    'onchange' : _callable([Event]),
+    'onclick' : _callable([MouseEvent]),
+    'onclose' : _callable([MouseEvent]),
+    'ondblclick' : _callable([MouseEvent]),
+    'ondragdrop' : _callable([MouseEvent]),
+    'onerror' : _callable([MouseEvent]),
+    'onfocus' : _callable([Event]),
+    'onkeydown' : _callable([KeyEvent]),
+    'onkeypress' : _callable([KeyEvent]),
+    'onkeyup' : _callable([KeyEvent]),
+    'onload' : _callable([KeyEvent]),
+    'onmousedown' : _callable([MouseEvent]),
+    'onmousemove' : _callable([MouseEvent]),
+    'onmouseup' : _callable([MouseEvent]),
+    'onmouseover' : _callable([MouseEvent]),
+    'onmouseup' : _callable([MouseEvent]),
+    'onresize' : _callable([Event]),
+    'onscroll' : _callable([MouseEvent]),
+    'onselect' : _callable([MouseEvent]),
+    'onsubmit' : _callable([MouseEvent]),
+    'onunload' : _callable([Event]),
 }
 
+lambda_returning_true = _callable([Event])
+
 EventTarget._methods = {
-    'addEventListener' : MethodDesc(["aa", lambda : None, True]),
-    'dispatchEvent' : MethodDesc(["aa"], True),
-    'removeEventListener' : MethodDesc(["aa", lambda : None, True]),
+    'addEventListener' : MethodDesc([str, lambda_returning_true]),
+    'dispatchEvent' : MethodDesc([str], bool),
+    'removeEventListener' : MethodDesc([str, lambda_returning_true]),
 }
 
 Node._fields = EventTarget._fields.copy()
 Node._fields.update({
-    'childNodes' : [Element()],
-    'firstChild' : Element(),
-    'lastChild' : Element(),
-    'localName' : "aa",
-    'name' : "aa",
-    'namespaceURI' : "aa",
-    'nextSibling' : Element(),
-    'nodeName' : "aa",
-    'nodeType' : 1,
-    'nodeValue' : "aa",
-    'ownerDocument' : Document(),
-    'parentNode' : Element(),
-    'prefix' : "aa",
-    'previousSibling': Element(),
-    'tagName' : "aa",
-    'textContent' : "aa",
+    'childNodes' : [Element],
+    'firstChild' : Element,
+    'lastChild' : Element,
+    'localName' : str,
+    'name' : str,
+    'namespaceURI' : str,
+    'nextSibling' : Element,
+    'nodeName' : str,
+    'nodeType' : int,
+    'nodeValue' : str,
+    'ownerDocument' : Document,
+    'parentNode' : Element,
+    'prefix' : str,
+    'previousSibling': Element,
+    'tagName' : str,
+    'textContent' : str,
 })
 
 Node._methods = EventTarget._methods.copy()
 Node._methods.update({
-    'appendChild' : MethodDesc([Element()]),
-    'cloneNode' : MethodDesc([12], Element()),
-    'getElementsByTagName' : MethodDesc(["aa"], [Element(),
-                                                 Element()]),
-    'hasChildNodes' : MethodDesc([], True),
-    'insertBefore' : MethodDesc([Element(), Element()], Element()),
+    'appendChild' : MethodDesc([Element]),
+    'cloneNode' : MethodDesc([int], Element),
+    'getElementsByTagName' : MethodDesc([str], [Element]),
+    'hasChildNodes' : MethodDesc([], bool),
+    'insertBefore' : MethodDesc([Element], Element),
     'normalize' : MethodDesc([]),
-    'removeChild' : MethodDesc([Element()], Element()),
-    'replaceChild' : MethodDesc([Element(), Element()], Element()),
+    'removeChild' : MethodDesc([Element]),
+    'replaceChild' : MethodDesc([Element], Element),
 })
 
 Element._fields = Node._fields.copy()
 Element._fields.update({
-    'attributes' : [Attribute()],
-    'className' : "aa",
-    'clientHeight' : 12,
-    'clientWidth' : 12,
-    'clientLeft' : 12,
-    'clientTop' : 12,
-    'dir' : "aa",
-    'innerHTML' : "asd",
-    'id' : "aa",
-    'lang' : "asd",
-    'offsetHeight' : 12,
-    'offsetLeft' : 12,
-    'offsetParent' : 12,
-    'offsetTop' : 12,
-    'offsetWidth' : 12,
-    'scrollHeight' : 12,
-    'scrollLeft' : 12,
-    'scrollTop' : 12,
-    'scrollWidth' : 12,
+    'attributes' : [Attribute],
+    'className' : str,
+    'clientHeight' : int,
+    'clientWidth' : int,
+    'clientLeft' : int,
+    'clientTop' : int,
+    'dir' : str,
+    'innerHTML' : str,
+    'id' : str,
+    'lang' : str,
+    'offsetHeight' : int,
+    'offsetLeft' : int,
+    'offsetParent' : int,
+    'offsetTop' : int,
+    'offsetWidth' : int,
+    'scrollHeight' : int,
+    'scrollLeft' : int,
+    'scrollTop' : int,
+    'scrollWidth' : int,
     # HTML specific
-    'style' : Style(),
-    'tabIndex' : 12,
+    'style' : Style,
+    'tabIndex' : int,
     # XXX: From HTMLInputElement to make pythonconsole work.
-    'value': 'aa',
+    'value': str,
 })
 
 Element._methods = Node._methods.copy()
 Element._methods.update({
-    'getAttribute' : MethodDesc(["aa"], "aa"),
-    'getAttributeNS' : MethodDesc(["aa", "aa"], "aa"),
-    'getAttributeNode' : MethodDesc(["aa"], Element()),
-    'getAttributeNodeNS' : MethodDesc(["aa", "aa"], Element()),
-    'hasAttribute' : MethodDesc(["aa"], True),
-    'hasAttributeNS' : MethodDesc(["aa", "aa"], True),
-    'hasAttributes' : MethodDesc([], True),
-    'removeAttribute' : MethodDesc(['aa']),
-    'removeAttributeNS' : MethodDesc(["aa", "aa"]),
-    'removeAttributeNode' : MethodDesc([Element()], "aa"),
-    'setAttribute' : MethodDesc(["aa", "aa"]),
-    'setAttributeNS' : MethodDesc(["aa", "aa", "aa"]),
-    'setAttributeNode' : MethodDesc([Element()], Element()),
-    'setAttributeNodeNS' : MethodDesc(["ns", Element()], Element()),
+    'getAttribute' : MethodDesc([str], str),
+    'getAttributeNS' : MethodDesc([str], str),
+    'getAttributeNode' : MethodDesc([str], Element),
+    'getAttributeNodeNS' : MethodDesc([str], Element),
+    'hasAttribute' : MethodDesc([str], bool),
+    'hasAttributeNS' : MethodDesc([str], bool),
+    'hasAttributes' : MethodDesc([], bool),
+    'removeAttribute' : MethodDesc([str]),
+    'removeAttributeNS' : MethodDesc([str]),
+    'removeAttributeNode' : MethodDesc([Element], str),
+    'setAttribute' : MethodDesc([str]),
+    'setAttributeNS' : MethodDesc([str]),
+    'setAttributeNode' : MethodDesc([Element], Element),
+    'setAttributeNodeNS' : MethodDesc([str, Element], Element),
     # HTML specific
     'blur' : MethodDesc([]),
     'click' : MethodDesc([]),
     'focus' : MethodDesc([]),
     'scrollIntoView' : MethodDesc([]),
-    'supports' : MethodDesc(["aa", 1.0]),
+    'supports' : MethodDesc([str, float]),
 })
 
 Document._fields = Node._fields.copy()
 Document._fields.update({
-    'characterSet' : "aa",
+    'characterSet' : str,
     # 'contentWindow' : Window(), XXX doesn't exist, only on iframe
-    'doctype' : "aa",
-    'documentElement' : Element(),
-    'styleSheets' : [Style(), Style()],
-    'alinkColor' : "aa",
-    'bgColor' : "aa",
-    'body' : Element(),
-    'cookie' : "aa",
-    'defaultView' : Window(),
-    'domain' : "aa",
-    'embeds' : [Element(), Element()],
-    'fgColor' : "aa",
-    'forms' : [Element(), Element()],
-    'height' : 123,
-    'images' : [Element(), Element()],
-    'lastModified' : "aa",
-    'linkColor' : "aa",
-    'links' : [Element(), Element()],
-    'location' : "aa",
-    'referrer' : "aa",
-    'title' : "aa",
-    'URL' : "aa",
-    'vlinkColor' : "aa",
-    'width' : 123,
+    'doctype' : str,
+    'documentElement' : Element,
+    'styleSheets' : [Style],
+    'alinkColor' : str,
+    'bgColor' : str,
+    'body' : Element,
+    'cookie' : str,
+    'defaultView' : Window,
+    'domain' : str,
+    'embeds' : [Element],
+    'fgColor' : str,
+    'forms' : [Element],
+    'height' : int,
+    'images' : [Element],
+    'lastModified' : str,
+    'linkColor' : str,
+    'links' : [Element],
+    'location' : str,
+    'referrer' : str,
+    'title' : str,
+    'URL' : str,
+    'vlinkColor' : str,
+    'width' : int,
 })
 
 Document._methods = Node._methods.copy()
 Document._methods.update({
-    'createAttribute' : MethodDesc(["aa"], Element()),
-    'createDocumentFragment' : MethodDesc([], Element()),
-    'createElement' : MethodDesc(["aa"], Element()),
-    'createElementNS' : MethodDesc(["aa", "aa"], Element()),
-    'createEvent' : MethodDesc(["aa"], Event()),
-    'createTextNode' : MethodDesc(["aa"], Element()),
+    'createAttribute' : MethodDesc([str], Element),
+    'createDocumentFragment' : MethodDesc([], Element),
+    'createElement' : MethodDesc([str], Element),
+    'createElementNS' : MethodDesc([str], Element),
+    'createEvent' : MethodDesc([str], Event),
+    'createTextNode' : MethodDesc([str], Element),
     #'createRange' : MethodDesc(["aa"], Range()) - don't know what to do here
-    'getElementById' : MethodDesc(["aa"], Element()),
-    'getElementsByName' : MethodDesc(["aa"], [Element(), Element()]),
-    'importNode' : MethodDesc([Element(), True], Element()),
+    'getElementById' : MethodDesc([str], Element),
+    'getElementsByName' : MethodDesc([str], [Element]),
+    'importNode' : MethodDesc([Element, bool], Element),
     'clear' : MethodDesc([]),
     'close' : MethodDesc([]),
     'open' : MethodDesc([]),
-    'write' : MethodDesc(["aa"]),
-    'writeln' : MethodDesc(["aa"]),
+    'write' : MethodDesc([str]),
+    'writeln' : MethodDesc([str]),
 })
 
 Window._fields = EventTarget._fields.copy()
 Window._fields.update({
-    'content' : Window(),
-    'closed' : True,
+    'content' : Window,
+    'closed' : bool,
     # 'crypto' : Crypto() - not implemented in Gecko, leave alone
-    'defaultStatus' : "aa",
-    'document' : Document(),
+    'defaultStatus' : str,
+    'document' : Document,
     # 'frameElement' :  - leave alone
-    'frames' : [Window(), Window()],
-    'history' : ["aa", "aa"],
-    'innerHeight' : 123,
-    'innerWidth' : 123,
-    'length' : 12,
-    'location' : "aa",
-    'name' : "aa",
+    'frames' : [Window],
+    'history' : [str],
+    'innerHeight' : int,
+    'innerWidth' : int,
+    'length' : int,
+    'location' : str,
+    'name' : str,
     # 'preference' : # denied in gecko
-    'opener' : Window(),
-    'outerHeight' : 123,
-    'outerWidth' : 123,
-    'pageXOffset' : 12,
-    'pageYOffset' : 12,
-    'parent' : Window(),
+    'opener' : Window,
+    'outerHeight' : int,
+    'outerWidth' : int,
+    'pageXOffset' : int,
+    'pageYOffset' : int,
+    'parent' : Window,
     # 'personalbar' :  - disallowed
     # 'screen' : Screen() - not part of the standard, allow it if you want
-    'screenX' : 12,
-    'screenY' : 12,
-    'scrollMaxX' : 12,
-    'scrollMaxY' : 12,
-    'scrollX' : 12,
-    'scrollY' : 12,
-    'self' : Window(),
-    'status' : "asd",
-    'top' : Window(),
-    'window' : Window(),
+    'screenX' : int,
+    'screenY' : int,
+    'scrollMaxX' : int,
+    'scrollMaxY' : int,
+    'scrollX' : int,
+    'scrollY' : int,
+    'self' : Window,
+    'status' : str,
+    'top' : Window,
+    'window' : Window,
 })
 
 Window._methods = Node._methods.copy()
 Window._methods.update({
-    'alert' : MethodDesc(["aa"]),
-    'atob' : MethodDesc(["aa"], "aa"),
+    'alert' : MethodDesc([str]),
+    'atob' : MethodDesc([str], str),
     'back' : MethodDesc([]),
     'blur' : MethodDesc([]),
-    'btoa' : MethodDesc(["aa"], "aa"),
+    'btoa' : MethodDesc([str], str),
     'close' : MethodDesc([]),
-    'confirm' : MethodDesc(["aa"], True),
-    'dump' : MethodDesc(["aa"]),
-    'escape' : MethodDesc(["aa"], "aa"),
+    'confirm' : MethodDesc([str], bool),
+    'dump' : MethodDesc([str]),
+    'escape' : MethodDesc([str], str),
     #'find' : MethodDesc(["aa"],  - gecko only
     'focus' : MethodDesc([]),
     'forward' : MethodDesc([]),
-    'getComputedStyle' : MethodDesc([Element(), "aa"], Style()),
+    'getComputedStyle' : MethodDesc([Element, str], Style),
     'home' : MethodDesc([]),
-    'open' : MethodDesc(["aa", "aa"]),
+    'open' : MethodDesc([str]),
 })
 
 Style._fields = {
-    'azimuth' : 'aa',
-    'background' : 'aa',
-    'backgroundAttachment' : 'aa',
-    'backgroundColor' : 'aa',
-    'backgroundImage' : 'aa',
-    'backgroundPosition' : 'aa',
-    'backgroundRepeat' : 'aa',
-    'border' : 'aa',
-    'borderBottom' : 'aa',
-    'borderBottomColor' : 'aa',
-    'borderBottomStyle' : 'aa',
-    'borderBottomWidth' : 'aa',
-    'borderCollapse' : 'aa',
-    'borderColor' : 'aa',
-    'borderLeft' : 'aa',
-    'borderLeftColor' : 'aa',
-    'borderLeftStyle' : 'aa',
-    'borderLeftWidth' : 'aa',
-    'borderRight' : 'aa',
-    'borderRightColor' : 'aa',
-    'borderRightStyle' : 'aa',
-    'borderRightWidth' : 'aa',
-    'borderSpacing' : 'aa',
-    'borderStyle' : 'aa',
-    'borderTop' : 'aa',
-    'borderTopColor' : 'aa',
-    'borderTopStyle' : 'aa',
-    'borderTopWidth' : 'aa',
-    'borderWidth' : 'aa',
-    'bottom' : 'aa',
-    'captionSide' : 'aa',
-    'clear' : 'aa',
-    'clip' : 'aa',
-    'color' : 'aa',
-    'content' : 'aa',
-    'counterIncrement' : 'aa',
-    'counterReset' : 'aa',
-    'cssFloat' : 'aa',
-    'cssText' : 'aa',
-    'cue' : 'aa',
-    'cueAfter' : 'aa',
-    'onBefore' : 'aa',
-    'cursor' : 'aa',
-    'direction' : 'aa',
-    'displays' : 'aa',
-    'elevation' : 'aa',
-    'emptyCells' : 'aa',
-    'font' : 'aa',
-    'fontFamily' : 'aa',
-    'fontSize' : 'aa',
-    'fontSizeAdjust' : 'aa',
-    'fontStretch' : 'aa',
-    'fontStyle' : 'aa',
-    'fontVariant' : 'aa',
-    'fontWeight' : 'aa',
-    'height' : 'aa',
-    'left' : 'aa',
-    'length' : 'aa',
-    'letterSpacing' : 'aa',
-    'lineHeight' : 'aa',
-    'listStyle' : 'aa',
-    'listStyleImage' : 'aa',
-    'listStylePosition' : 'aa',
-    'listStyleType' : 'aa',
-    'margin' : 'aa',
-    'marginBottom' : 'aa',
-    'marginLeft' : 'aa',
-    'marginRight' : 'aa',
-    'marginTop' : 'aa',
-    'markerOffset' : 'aa',
-    'marks' : 'aa',
-    'maxHeight' : 'aa',
-    'maxWidth' : 'aa',
-    'minHeight' : 'aa',
-    'minWidth' : 'aa',
-    'MozBinding' : 'aa',
-    'MozOpacity' : 'aa',
-    'orphans' : 'aa',
-    'outline' : 'aa',
-    'outlineColor' : 'aa',
-    'outlineStyle' : 'aa',
-    'outlineWidth' : 'aa',
-    'overflow' : 'aa',
-    'padding' : 'aa',
-    'paddingBottom' : 'aa',
-    'paddingLeft' : 'aa',
-    'paddingRight' : 'aa',
-    'paddingTop' : 'aa',
-    'page' : 'aa',
-    'pageBreakAfter' : 'aa',
-    'pageBreakBefore' : 'aa',
-    'pageBreakInside' : 'aa',
-    'parentRule' : 'aa',
-    'pause' : 'aa',
-    'pauseAfter' : 'aa',
-    'pauseBefore' : 'aa',
-    'pitch' : 'aa',
-    'pitchRange' : 'aa',
-    'playDuring' : 'aa',
-    'position' : 'aa',
-    'quotes' : 'aa',
-    'richness' : 'aa',
-    'right' : 'aa',
-    'size' : 'aa',
-    'speak' : 'aa',
-    'speakHeader' : 'aa',
-    'speakNumeral' : 'aa',
-    'speakPunctuation' : 'aa',
-    'speechRate' : 'aa',
-    'stress' : 'aa',
-    'tableLayout' : 'aa',
-    'textAlign' : 'aa',
-    'textDecoration' : 'aa',
-    'textIndent' : 'aa',
-    'textShadow' : 'aa',
-    'textTransform' : 'aa',
-    'top' : 'aa',
-    'unicodeBidi' : 'aa',
-    'verticalAlign' : 'aa',
-    'visibility' : 'aa',
-    'voiceFamily' : 'aa',
-    'volume' : 'aa',
-    'whiteSpace' : 'aa',
-    'widows' : 'aa',
-    'width' : 'aa',
-    'wordSpacing' : 'aa',
-    'zIndex' : 'aa',
+    'azimuth' : str,
+    'background' : str,
+    'backgroundAttachment' : str,
+    'backgroundColor' : str,
+    'backgroundImage' : str,
+    'backgroundPosition' : str,
+    'backgroundRepeat' : str,
+    'border' : str,
+    'borderBottom' : str,
+    'borderBottomColor' : str,
+    'borderBottomStyle' : str,
+    'borderBottomWidth' : str,
+    'borderCollapse' : str,
+    'borderColor' : str,
+    'borderLeft' : str,
+    'borderLeftColor' : str,
+    'borderLeftStyle' : str,
+    'borderLeftWidth' : str,
+    'borderRight' : str,
+    'borderRightColor' : str,
+    'borderRightStyle' : str,
+    'borderRightWidth' : str,
+    'borderSpacing' : str,
+    'borderStyle' : str,
+    'borderTop' : str,
+    'borderTopColor' : str,
+    'borderTopStyle' : str,
+    'borderTopWidth' : str,
+    'borderWidth' : str,
+    'bottom' : str,
+    'captionSide' : str,
+    'clear' : str,
+    'clip' : str,
+    'color' : str,
+    'content' : str,
+    'counterIncrement' : str,
+    'counterReset' : str,
+    'cssFloat' : str,
+    'cssText' : str,
+    'cue' : str,
+    'cueAfter' : str,
+    'onBefore' : str,
+    'cursor' : str,
+    'direction' : str,
+    'displays' : str,
+    'elevation' : str,
+    'emptyCells' : str,
+    'font' : str,
+    'fontFamily' : str,
+    'fontSize' : str,
+    'fontSizeAdjust' : str,
+    'fontStretch' : str,
+    'fontStyle' : str,
+    'fontVariant' : str,
+    'fontWeight' : str,
+    'height' : str,
+    'left' : str,
+    'length' : str,
+    'letterSpacing' : str,
+    'lineHeight' : str,
+    'listStyle' : str,
+    'listStyleImage' : str,
+    'listStylePosition' : str,
+    'listStyleType' : str,
+    'margin' : str,
+    'marginBottom' : str,
+    'marginLeft' : str,
+    'marginRight' : str,
+    'marginTop' : str,
+    'markerOffset' : str,
+    'marks' : str,
+    'maxHeight' : str,
+    'maxWidth' : str,
+    'minHeight' : str,
+    'minWidth' : str,
+    'MozBinding' : str,
+    'MozOpacity' : str,
+    'orphans' : str,
+    'outline' : str,
+    'outlineColor' : str,
+    'outlineStyle' : str,
+    'outlineWidth' : str,
+    'overflow' : str,
+    'padding' : str,
+    'paddingBottom' : str,
+    'paddingLeft' : str,
+    'paddingRight' : str,
+    'paddingTop' : str,
+    'page' : str,
+    'pageBreakAfter' : str,
+    'pageBreakBefore' : str,
+    'pageBreakInside' : str,
+    'parentRule' : str,
+    'pause' : str,
+    'pauseAfter' : str,
+    'pauseBefore' : str,
+    'pitch' : str,
+    'pitchRange' : str,
+    'playDuring' : str,
+    'position' : str,
+    'quotes' : str,
+    'richness' : str,
+    'right' : str,
+    'size' : str,
+    'speak' : str,
+    'speakHeader' : str,
+    'speakNumeral' : str,
+    'speakPunctuation' : str,
+    'speechRate' : str,
+    'stress' : str,
+    'tableLayout' : str,
+    'textAlign' : str,
+    'textDecoration' : str,
+    'textIndent' : str,
+    'textShadow' : str,
+    'textTransform' : str,
+    'top' : str,
+    'unicodeBidi' : str,
+    'verticalAlign' : str,
+    'visibility' : str,
+    'voiceFamily' : str,
+    'volume' : str,
+    'whiteSpace' : str,
+    'widows' : str,
+    'width' : str,
+    'wordSpacing' : str,
+    'zIndex' : str,
 }
 
 Event._fields = {
-    'bubbles': True,
-    'cancelBubble': True,
-    'cancelable': True,
-    'currentTarget': Element(),
-    'detail': 1,
-    'relatedTarget': Element(),
-    'target': Element(),
-    'type': 'aa',
+    'bubbles': bool,
+    'cancelBubble': bool,
+    'cancelable': bool,
+    'currentTarget': Element,
+    'detail': int,
+    'relatedTarget': Element,
+    'target': Element,
+    'type': str,
 }
 
 Event._methods = {
-    'initEvent': MethodDesc(["aa", True, True]),
+    'initEvent': MethodDesc([str, bool, bool]),
     'preventDefault': MethodDesc([]),
     'stopPropagation': MethodDesc([]),
 }
 
 KeyEvent._fields = Event._fields.copy()
 KeyEvent._fields.update({
-    'keyCode' : 12,
-    'charCode' : 12,
+    'keyCode' : int,
+    'charCode' : int,
 })
 
 setTimeout.suggested_primitive = True

Modified: pypy/dist/pypy/translator/js/modules/test/test_dom.py
==============================================================================
--- pypy/dist/pypy/translator/js/modules/test/test_dom.py	(original)
+++ pypy/dist/pypy/translator/js/modules/test/test_dom.py	Sat Jan 13 18:14:07 2007
@@ -371,6 +371,6 @@
         if var.startswith('code_'):
             # just build it
             #def f():
-            assert rpython2javascript(sys.modules[__name__], [var], use_pdb=False)
+            assert rpython2javascript(sys.modules[__name__], [var], use_pdb=True)
     
     TRANSLATING = False



More information about the Pypy-commit mailing list