##// END OF EJS Templates
Add assert_not_in method for Python2.6
Thomas Kluyver -
Show More
@@ -1,11 +1,17 b''
1 """Add some assert methods to nose.tools. These were added in Python 2.7/3.1, so
1 """Add some assert methods to nose.tools. These were added in Python 2.7/3.1, so
2 once we stop testing on Python 2.6, this file can be removed.
2 once we stop testing on Python 2.6, this file can be removed.
3 """
3 """
4
4
5 import nose.tools as nt
5 import nose.tools as nt
6
6
7 def assert_in(item, collection):
7 def assert_in(item, collection):
8 assert item in collection, '%r not in %r' % (item, collection)
8 assert item in collection, '%r not in %r' % (item, collection)
9
9
10 if not hasattr(nt, 'assert_in'):
10 if not hasattr(nt, 'assert_in'):
11 nt.assert_in = assert_in
11 nt.assert_in = assert_in
12
13 def assert_not_in(item, collection):
14 assert item not in collection, '%r in %r' % (item, collection)
15
16 if not hasattr(nt, 'assert_not_in'):
17 nt.assert_not_in = assert_not_in
General Comments 0
You need to be logged in to leave comments. Login now