Skip to content
Browse files

More thorough unit tests

  • Loading branch information...
1 parent c77b764 commit ca8e042696c47857e7e512bc4744f104f14a2895 @l0b0 l0b0 committed Oct 19, 2010
Showing with 4 additions and 15 deletions.
  1. +4 −15 tests/tests.py
View
19 tests/tests.py
@@ -16,6 +16,7 @@
from doctest import testmod
from os.path import join, dirname
+from re import search
import unittest
from img2scad import img2scad
@@ -31,32 +32,20 @@ class TestConvert(unittest.TestCase):
def test_small(self):
"""Check that a single pixel image gives output."""
result = img2scad.img2scad(open(EXAMPLE_SMALL), 0)
- self.assertNotEqual(
- result,
- '')
- self.assertNotEqual(
- result,
- 'module qrcode() {\n}\nqrcode();')
+ self.assertTrue(search(r'translate.*cube', result))
def test_big(self):
"""Check that a big image gives output."""
result = img2scad.img2scad(open(EXAMPLE_BIG), 1)
- self.assertNotEqual(
- result,
- '')
- self.assertNotEqual(
- result,
- 'module qrcode() {\n}\nqrcode();')
+ self.assertTrue(search(r'translate.*cube', result))
def test_zero(self):
"""Check that if the minimum is shifted sufficiently, the result is
empty."""
result = img2scad.img2scad(open(EXAMPLE_SMALL), -152)
- self.assertEqual(
- result,
- 'module topography() {\n}\ntopography();')
+ self.assertFalse(search(r'translate.*cube', result))
class TestDoc(unittest.TestCase):

0 comments on commit ca8e042

Please sign in to comment.
Something went wrong with that request. Please try again.