Move unit tests and images to subfolders
authorThomas Perl <m@thp.io>
Wed, 28 Sep 2011 19:10:07 +0000 (21:10 +0200)
committerThomas Perl <m@thp.io>
Wed, 28 Sep 2011 19:10:07 +0000 (21:10 +0200)
12 files changed:
README
gotovienna/tests/__init__.py [new file with mode: 0644]
gotovienna/tests/realtime.py [new file with mode: 0644]
gotovienna/tests/routing.py [new file with mode: 0644]
gotovienna/tests/runner.py [new file with mode: 0644]
images/logo.png [new file with mode: 0644]
images/logo.svg [new file with mode: 0644]
logo.png [deleted file]
logo.svg [deleted file]
tests/__init__.py [deleted file]
tests/realtime.py [deleted file]
tests/routing.py [deleted file]

diff --git a/README b/README
index e225d65..d80b35c 100644 (file)
--- a/README
+++ b/README
@@ -4,3 +4,8 @@ Using qml gui to show results
 Show next bus/tram/underground departures.
 
 This program ist unofficial.
+
+Running unit tests:
+
+$ python -m gotovienna.tests.runner
+
diff --git a/gotovienna/tests/__init__.py b/gotovienna/tests/__init__.py
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/gotovienna/tests/realtime.py b/gotovienna/tests/realtime.py
new file mode 100644 (file)
index 0000000..d7cf44a
--- /dev/null
@@ -0,0 +1,26 @@
+import unittest
+import sys
+import os
+sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
+
+from gotovienna.realtime import *
+
+parser = ITipParser()
+
+class ParseTest(unittest.TestCase):
+    
+    def test_lines(self):
+        lines = parser.lines
+        self.assertTrue(type(lines) == dict)
+        self.assertTrue(lines)
+    
+    def test_stations(self):
+        lines = parser.lines
+        
+        s = []
+        for line in lines:
+            s.append(parser.get_stations(line[0]))
+        self.assertTrue(s)
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/gotovienna/tests/routing.py b/gotovienna/tests/routing.py
new file mode 100644 (file)
index 0000000..3f27286
--- /dev/null
@@ -0,0 +1,74 @@
+# -*- coding: utf-8 -*-
+
+import unittest
+from datetime import datetime
+
+from gotovienna.routing import *
+
+dtime = datetime.now()
+dtime = dtime.replace(hour=15, minute=0)
+
+origin = u'Börse'.encode('UTF-8')
+destination = 'Handelskai'
+s = search((origin, 'stop'), (destination, 'stop'), dtime).read()
+parser = sParser(s)
+p = rParser(s)
+
+
+originc = 'Simmeri'
+destinationc = 'Karlspla'
+sc = search((originc, 'stop'), (destinationc, 'stop'), dtime).read()
+parserc = sParser(sc)
+
+
+origina = 'Zwicklgasse 1'
+destinationa = 'Himmelstrasse 1'
+ot = dt = 'address'
+
+
+originac = 'Foobar Strasse 123'
+destinationac = 'Bazgasse 321'
+
+
+class SearchTest(unittest.TestCase):
+
+    def test_state(self):
+        state = parser.check_page()
+        statec = parserc.check_page()
+        
+        self.assertEqual(PageType.RESULT, state)
+        self.assertEqual(PageType.CORRECTION, statec)
+        
+    def test_correction(self):
+        cor = parserc.get_correction()
+        s = search((cor[0][0], 'stop'), (cor[1][0], 'stop'), dtime).read()
+        parser = sParser(s)
+        self.assertEqual(PageType.RESULT, parser.check_page())
+    
+    def test_overview_shouldFindMultipleItems(self):
+        # TODO Replace with assertGreater in new python version
+        self.assertTrue(len(p.overview) > 1)
+
+    def test_detail_shouldFindMultipleItems(self):
+        # TODO Replace with assertGreater in new python version
+        self.assertTrue(len(p.details) > 1)
+
+    def test_detail_shouldFindMultipleStations(self):
+        # TODO Replace with assertGreater in new python version
+        self.assertTrue(len(p.details[0]) > 1)
+
+    def test_parser_overviewAndDetailsShouldHaveSameLength(self):
+        self.assertEqual(len(p.details), len(p.overview))
+
+    def test_parser_shouldFindMoreThanOneChange(self):
+        self.assertTrue(p.overview[0]['change'] > 0)
+
+    def test_parser_shouldFindPriceGreaterZero(self):
+        self.assertTrue(p.overview[0]['price'] > 0.0)
+
+    def test_parser_shouldFindDate(self):
+        self.assertTrue(p.overview[0]['date'] == dtime.date())
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/gotovienna/tests/runner.py b/gotovienna/tests/runner.py
new file mode 100644 (file)
index 0000000..7c520f9
--- /dev/null
@@ -0,0 +1,11 @@
+
+import unittest
+
+# XXX: This is not really nice - we should use some kind of discovery
+
+from gotovienna.tests.realtime import *
+from gotovienna.tests.routing import *
+
+if __name__ == '__main__':
+    unittest.main()
+
diff --git a/images/logo.png b/images/logo.png
new file mode 100644 (file)
index 0000000..fec950d
Binary files /dev/null and b/images/logo.png differ
diff --git a/images/logo.svg b/images/logo.svg
new file mode 100644 (file)
index 0000000..58f9914
--- /dev/null
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="69.099609"
+   height="34.263847"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.0 r9654"
+   sodipodi:docname="logo.svg"
+   inkscape:export-filename="logo.png"
+   inkscape:export-xdpi="100"
+   inkscape:export-ydpi="100">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="2.8"
+     inkscape:cx="162.5537"
+     inkscape:cy="87.339922"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1920"
+     inkscape:window-height="1170"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1"
+     fit-margin-top="0"
+     fit-margin-left="0"
+     fit-margin-right="0"
+     fit-margin-bottom="0" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(-55.714287,-69.844879)">
+    <text
+       xml:space="preserve"
+       style="font-size:24px;font-style:normal;font-weight:normal;line-height:69.99999881%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+       x="55.714287"
+       y="89.505035"
+       id="text2985"
+       sodipodi:linespacing="69.999999%"><tspan
+         sodipodi:role="line"
+         id="tspan2987"
+         x="55.714287"
+         y="89.505035"
+         dy="0 -5.48"
+         dx="0 0"><tspan
+           style="font-size:40px;line-height:69.99999880999997970%;fill:#e30014;fill-opacity:0.94117647"
+           id="tspan2989"
+           dy="5.48"
+           dx="0"
+           rotate="0 0">g</tspan><tspan
+           style="font-size:28px"
+           id="tspan3267">oto</tspan></tspan><tspan
+         sodipodi:role="line"
+         x="55.714287"
+         y="104.10873"
+         dy="0 0 0 0 0 -0.02"
+         dx="0 0 0 0 0 0"
+         id="tspan3005"
+         style="font-size:16px;line-height:69.99999881%">    </tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:24px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+       x="78.951591"
+       y="103.91048"
+       id="text3263"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan3265"
+         x="78.951591"
+         y="103.91048"
+         style="font-size:14px">vienna</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:24px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+       x="41.289986"
+       y="81.858124"
+       id="text3269"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan3271"
+         x="41.289986"
+         y="81.858124" /></text>
+  </g>
+</svg>
diff --git a/logo.png b/logo.png
deleted file mode 100644 (file)
index fec950d..0000000
Binary files a/logo.png and /dev/null differ
diff --git a/logo.svg b/logo.svg
deleted file mode 100644 (file)
index 58f9914..0000000
--- a/logo.svg
+++ /dev/null
@@ -1,112 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://creativecommons.org/ns#"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="69.099609"
-   height="34.263847"
-   id="svg2"
-   version="1.1"
-   inkscape:version="0.48.0 r9654"
-   sodipodi:docname="logo.svg"
-   inkscape:export-filename="logo.png"
-   inkscape:export-xdpi="100"
-   inkscape:export-ydpi="100">
-  <defs
-     id="defs4" />
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="2.8"
-     inkscape:cx="162.5537"
-     inkscape:cy="87.339922"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     showgrid="false"
-     inkscape:window-width="1920"
-     inkscape:window-height="1170"
-     inkscape:window-x="0"
-     inkscape:window-y="0"
-     inkscape:window-maximized="1"
-     fit-margin-top="0"
-     fit-margin-left="0"
-     fit-margin-right="0"
-     fit-margin-bottom="0" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1"
-     transform="translate(-55.714287,-69.844879)">
-    <text
-       xml:space="preserve"
-       style="font-size:24px;font-style:normal;font-weight:normal;line-height:69.99999881%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
-       x="55.714287"
-       y="89.505035"
-       id="text2985"
-       sodipodi:linespacing="69.999999%"><tspan
-         sodipodi:role="line"
-         id="tspan2987"
-         x="55.714287"
-         y="89.505035"
-         dy="0 -5.48"
-         dx="0 0"><tspan
-           style="font-size:40px;line-height:69.99999880999997970%;fill:#e30014;fill-opacity:0.94117647"
-           id="tspan2989"
-           dy="5.48"
-           dx="0"
-           rotate="0 0">g</tspan><tspan
-           style="font-size:28px"
-           id="tspan3267">oto</tspan></tspan><tspan
-         sodipodi:role="line"
-         x="55.714287"
-         y="104.10873"
-         dy="0 0 0 0 0 -0.02"
-         dx="0 0 0 0 0 0"
-         id="tspan3005"
-         style="font-size:16px;line-height:69.99999881%">    </tspan></text>
-    <text
-       xml:space="preserve"
-       style="font-size:24px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
-       x="78.951591"
-       y="103.91048"
-       id="text3263"
-       sodipodi:linespacing="125%"><tspan
-         sodipodi:role="line"
-         id="tspan3265"
-         x="78.951591"
-         y="103.91048"
-         style="font-size:14px">vienna</tspan></text>
-    <text
-       xml:space="preserve"
-       style="font-size:24px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
-       x="41.289986"
-       y="81.858124"
-       id="text3269"
-       sodipodi:linespacing="125%"><tspan
-         sodipodi:role="line"
-         id="tspan3271"
-         x="41.289986"
-         y="81.858124" /></text>
-  </g>
-</svg>
diff --git a/tests/__init__.py b/tests/__init__.py
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/tests/realtime.py b/tests/realtime.py
deleted file mode 100644 (file)
index 9d2b1e3..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-import unittest
-import sys
-import os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
-from iTip import iParser
-
-parser = iParser()
-
-class ParseTest(unittest.TestCase):
-    
-    def test_lines(self):
-        lines = parser.lines
-        self.assertTrue(type(lines) == dict)
-        self.assertTrue(lines)
-    
-    def test_stations(self):
-        lines = parser.lines
-        
-        s = []
-        for line in lines:
-            s.append(parser.get_stations(line[0]))
-        self.assertTrue(s)
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/tests/routing.py b/tests/routing.py
deleted file mode 100644 (file)
index 07a9d90..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: UTF-8 -*-
-import unittest
-from scotty import search, ParserError, sParser, rParser, PageType
-from datetime import datetime
-from BeautifulSoup import BeautifulSoup
-
-dtime = datetime.now()
-dtime = dtime.replace(hour=15, minute=0)
-
-origin = u'Börse'.encode('UTF-8')
-destination = 'Handelskai'
-s = search((origin, 'stop'), (destination, 'stop'), dtime).read()
-parser = sParser(s)
-p = rParser(s)
-
-
-originc = 'Simmeri'
-destinationc = 'Karlspla'
-sc = search((originc, 'stop'), (destinationc, 'stop'), dtime).read()
-parserc = sParser(sc)
-
-
-origina = 'Zwicklgasse 1'
-destinationa = 'Himmelstrasse 1'
-ot = dt = 'address'
-
-
-originac = 'Foobar Strasse 123'
-destinationac = 'Bazgasse 321'
-
-
-class SearchTest(unittest.TestCase):
-
-    def test_state(self):
-        state = parser.check_page()
-        statec = parserc.check_page()
-        
-        self.assertEqual(PageType.RESULT, state)
-        self.assertEqual(PageType.CORRECTION, statec)
-        
-    def test_correction(self):
-        cor = parserc.get_correction()
-        s = search((cor[0][0], 'stop'), (cor[1][0], 'stop'), dtime).read()
-        parser = sParser(s)
-        self.assertEqual(PageType.RESULT, parser.check_page())
-    
-    def test_overview_shouldFindMultipleItems(self):
-        # TODO Replace with assertGreater in new python version
-        self.assertTrue(len(p.overview) > 1)
-
-    def test_detail_shouldFindMultipleItems(self):
-        # TODO Replace with assertGreater in new python version
-        self.assertTrue(len(p.details) > 1)
-
-    def test_detail_shouldFindMultipleStations(self):
-        # TODO Replace with assertGreater in new python version
-        self.assertTrue(len(p.details[0]) > 1)
-
-    def test_parser_overviewAndDetailsShouldHaveSameLength(self):
-        self.assertEqual(len(p.details), len(p.overview))
-
-    def test_parser_shouldFindMoreThanOneChange(self):
-        self.assertTrue(p.overview[0]['change'] > 0)
-
-    def test_parser_shouldFindPriceGreaterZero(self):
-        self.assertTrue(p.overview[0]['price'] > 0.0)
-
-    def test_parser_shouldFindDate(self):
-        self.assertTrue(p.overview[0]['date'] == dtime.date())
-
-
-if __name__ == '__main__':
-    unittest.main()