Commits

Dustin Chapman committed 9523be9

wrote starter tests for Loop
refs #1

Comments (0)

Files changed (1)

tests/test_loop.py

+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+
+from gevent.pool import Pool
+from nose.tools import raises, with_setup
+import sys
+sys.path.append('src')
+
+
+def test_import():
+    from aloft.core import Loop
+
+
+def setup():
+    from aloft.core import Loop
+
+def teardown():
+    del Loop
+
+
+@with_setup(setup, teardown)
+def test_subclass():
+    assert issubclass(Loop, Pool)
+
+
+@with_setup(setup, teardown)
+def test_good_constructor():
+    yield good_constructor, None, -2, -1, 0, 1, 10, 100, 1000000, 0x01
+
+def good_constructor(arg):
+    assert Loop(arg)
+
+
+@with_setup(setup, teardown)
+def test_bad_constructor():
+    yield bad_constructor, 0.1, '1', u'1'
+
+@raises(TypeError)
+def bad_constructor(arg):
+    Loop(arg)