Skip to content

Commit

Permalink
Add some tests for importability.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Feb 11, 2015
1 parent 63d1a83 commit c074810
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from nose.tools import raises

import unittest2

import bugwarrior.utils
Expand All @@ -8,6 +10,10 @@ def setUp(self):
self.d = bugwarrior.utils.DeferredImportingDict({
'chain': 'itertools:chain',
})
self.fail = bugwarrior.utils.DeferredImportingDict({
'dne1': 'itertools:DNE',
'dne2': 'notarealmodule:something',
})

def test_importing_dict_access_success(self):
item = self.d['chain']
Expand All @@ -22,3 +28,11 @@ def test_importing_dict_contains_failure(self):

def test_importing_dict_keys(self):
self.assertEquals(set(self.d.keys()), set(['chain']))

@raises(ImportError)
def test_importing_unimportable_object(self):
self.fail['dne1']

@raises(ImportError)
def test_importing_unimportable_module(self):
self.fail['dne2']

0 comments on commit c074810

Please sign in to comment.