Skip to content

Instantly share code, notes, and snippets.

@gandroz
Created February 21, 2020 21:25
Show Gist options
  • Save gandroz/dc00b9de353d8274b270e798dd24be3e to your computer and use it in GitHub Desktop.
Save gandroz/dc00b9de353d8274b270e798dd24be3e to your computer and use it in GitHub Desktop.
gitlab_snippet
"""
Unit testing of the automatic batch processing application
"""
import unittest
from src.app import squares
class AppTests(unittest.TestCase):
def test_app(self):
"""Simple Tests"""
self.assertEqual(squares(10), 100)
self.assertNotEqual(squares(2), 5)
def test_errors(self):
"""Check that method fails when parameter type is not numeric"""
with self.assertRaises(TypeError):
squares("foo")
def suite():
_suite = unittest.TestSuite()
_suite.addTest(AppTests('test_app'))
_suite.addTest(AppTests('test_errors'))
return _suite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment