Skip to content

Commit

Permalink
Added decorator test
Browse files Browse the repository at this point in the history
  • Loading branch information
ryankanno committed Aug 27, 2014
1 parent 9ed8a1b commit cbe032b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
# -*- coding: utf-8 -*-

from nose.tools import ok_
import os
from py_utilities.decorators import apply
from py_utilities.decorators import run_once
from py_utilities.decorators import safe
import unittest


Expand All @@ -23,6 +25,11 @@ def foo_once():
return [1, 2, 3]


@safe(lambda path: os.stat(path), None)
def fake_foo():
pass


class TestDecorator(unittest.TestCase):

def test_apply(self):
Expand All @@ -39,4 +46,8 @@ def test_run_once(self):
ok_(foo_once.__name__ == 'foo_once')
ok_(foo_once.__doc__ == ' Foo_once docstring ')

def test_safe(self):
result = fake_foo('/var/tmp/asdlkfjsadlkfjasdklfjasl')
ok_(result is None)

# vim: filetype=python

0 comments on commit cbe032b

Please sign in to comment.