Unit Tests

- Added partial match tests for dates.
This commit is contained in:
Paul Beckingham 2014-09-09 22:19:26 -04:00
parent a0736706e8
commit 2f03fc5d56

33
test/partial.t Executable file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import sys
import os
import unittest
from datetime import datetime
# Ensure python finds the local simpletap module
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from basetest import Task, TestCase
class TestPartialMatch(TestCase):
@classmethod
def setUpClass(cls):
cls.t = Task()
def test_partial_date_match(self):
"""Partial match for dates: today=now --> true"""
code, out, err = self.t(('calc', 'today=now'))
self.assertIn('true', out)
def test_exact_date_match(self):
"""Exact match for dates: today==now --> false"""
code, out, err = self.t(('calc', 'today==now'))
self.assertIn('false', out)
if __name__ == "__main__":
from simpletap import TAPTestRunner
unittest.main(testRunner=TAPTestRunner())
# vim: ai sts=4 et sw=4