bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
5177.1.1
by Vincent Ladeuil
Manually assign docstrings to command objects, so that they work with python -OO |
1 |
# Copyright (C) 2006-2010 Canonical Ltd
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
2 |
#
|
|
1185.70.5
by Martin Pool
Pass through wrapped function name and docstrign |
3 |
# This program is free software; you can redistribute it and/or modify
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
7 |
#
|
|
1185.70.5
by Martin Pool
Pass through wrapped function name and docstrign |
8 |
# This program is distributed in the hope that it will be useful,
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
12 |
#
|
|
1185.70.5
by Martin Pool
Pass through wrapped function name and docstrign |
13 |
# You should have received a copy of the GNU General Public License
|
14 |
# along with this program; if not, write to the Free Software
|
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
1185.70.5
by Martin Pool
Pass through wrapped function name and docstrign |
16 |
|
17 |
||
18 |
"""Tests for decorator functions"""
|
|
19 |
||
|
2230.2.4
by John Arbash Meinel
Add tests that decorators generate useful wrappers. |
20 |
import inspect |
21 |
||
|
6754.8.9
by Jelmer Vernooij
Fix more tests. |
22 |
from .. import ( |
23 |
decorators, |
|
24 |
lock, |
|
25 |
)
|
|
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
26 |
from . import TestCase |
|
1185.70.5
by Martin Pool
Pass through wrapped function name and docstrign |
27 |
|
28 |
||
|
4634.62.2
by Andrew Bennetts
Update test_decorators, add docstring. |
29 |
class SampleUnlockError(Exception): |
30 |
pass
|
|
31 |
||
32 |
||
33 |
class TestOnlyRaisesDecorator(TestCase): |
|
34 |
||
35 |
def raise_ZeroDivisionError(self): |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
36 |
1 / 0 |
|
6754.8.17
by Jelmer Vernooij
Remove uses of needs_write_lock. |
37 |
|
|
4634.62.2
by Andrew Bennetts
Update test_decorators, add docstring. |
38 |
def test_raises_approved_error(self): |
39 |
decorator = decorators.only_raises(ZeroDivisionError) |
|
40 |
decorated_meth = decorator(self.raise_ZeroDivisionError) |
|
41 |
self.assertRaises(ZeroDivisionError, decorated_meth) |
|
42 |
||
43 |
def test_quietly_logs_unapproved_errors(self): |
|
44 |
decorator = decorators.only_raises(IOError) |
|
45 |
decorated_meth = decorator(self.raise_ZeroDivisionError) |
|
46 |
self.assertLogsError(ZeroDivisionError, decorated_meth) |