From c926a2ebf9f98ec7d82f17c1b5e2e6241e02f148 Mon Sep 17 00:00:00 2001 From: Carsten Grohmann Date: Tue, 11 Jan 2022 17:29:31 +0100 Subject: [PATCH] Use more JS-like syntax for mock objects --- OOMAnalyser.py | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/OOMAnalyser.py b/OOMAnalyser.py index 09a6049..bdf8efa 100644 --- a/OOMAnalyser.py +++ b/OOMAnalyser.py @@ -30,16 +30,38 @@ class classList: class document: - def querySelectorAll(self, *args, **kwargs): + def querySelectorAll(self, *args,): return [Node()] - def getElementById(self, *arg, **kwargs): + @staticmethod + def getElementById(_id): + """ + Returns a object representing the element whose id property matches + + @type _id: str + @rtype: Node + """ return Node() - def createElementNS(self, *arg, **kwargs): + @staticmethod + def createElementNS(namespaceURI, qualifiedName, *arg): + """ + Creates an element with the specified namespace URI and qualified name. + + @param str namespaceURI: Namespace URI to associate with the element + @param str qualifiedName: Type of element to be created + @rtype: Node + """ return Node() - def createElement(self, *args, **kwargs): + @staticmethod + def createElement(tagName, *args): + """ + Creates the HTML element specified by tagName. + + @param str tagName: Type of element to be created + @rtype: Node + """ return Node()