Browse Source

verify Added FortuneHTMLParser

Mike Smith 11 years ago
parent
commit
d755b092e5

+ 1 - 0
go/setup.py

@@ -12,6 +12,7 @@ def start(args, logfile, errfile):
     subprocess.call("set GOPATH=C:\\FrameworkBenchmarks\\go&& go get ./...", shell=True, cwd="go", stderr=errfile, stdout=logfile)
     subprocess.Popen("setup.bat", shell=True, cwd="go", stderr=errfile, stdout=logfile) 
     return 0
+  os.environ["GOPATH"] = os.path.expanduser('~/FrameworkBenchmarks/go')
   subprocess.call("go get ./...", shell=True, cwd="go", stderr=errfile, stdout=logfile) 
   subprocess.Popen("go run src/hello/hello.go".rsplit(" "), cwd="go", stderr=errfile, stdout=logfile)
   return 0

+ 17 - 0
toolset/benchmark/FortuneHTMLParser.py

@@ -0,0 +1,17 @@
+from HTMLParser import HTMLParser
+
+class FortuneHTMLParser(HTMLParser):
+  body = []
+
+  def handle_starttag(self, tag, attrs):
+    print "start tag: '{s}'".format(s=tag)
+
+  def handle_data (self, data):
+    print "data: '{s}'".format(s=data)
+
+  def handle_endtag(self, tag):
+    print "end tag: '{s}'".format(s=tag)
+
+
+  def isValidFortune(self):
+    return True

+ 0 - 18
toolset/benchmark/JSONHTMLParser.py

@@ -1,18 +0,0 @@
-from HTMLParser import HTMLParser
-
-# HTMLParser which treats all tags as superfluous
-# markup, and appends every bit of data to an object
-# that gets returned later.
-class JSONHTMLParser(HTMLParser):
-  # We are going to append out data to this.
-  body = []
-
-  # Every instance of data inside of an html node
-  # will cause this function to be called.
-  def handle_data (self, data):
-    self.body.append(data)
-
-  # After a parse of an html document, this method
-  # will get the body parsed out as a string.
-  def getBody(self):
-    return str(self.body);

+ 0 - 4
toolset/benchmark/JSONValidator.py

@@ -1,4 +0,0 @@
-import json
-
-class JSONValidator():
-

+ 3 - 1
toolset/benchmark/framework_test.py

@@ -168,7 +168,9 @@ class FrameworkTest:
   #
   ############################################################
   def validateFortune(self, htmlString):
-    return True
+    fortuneValidator = FortuneHTMLParser(htmlString)
+
+    return fortuneValidator.isValidFortune()
 
   ############################################################
   # Validates the jsonString is an array with a length of