File: nose_assert_methods.py

package info (click to toggle)
ipython 0.13.1-2%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 15,752 kB
  • sloc: python: 69,537; makefile: 355; lisp: 272; sh: 80; objc: 37
file content (17 lines) | stat: -rw-r--r-- 516 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
"""Add some assert methods to nose.tools. These were added in Python 2.7/3.1, so
once we stop testing on Python 2.6, this file can be removed.
"""

import nose.tools as nt

def assert_in(item, collection):
    assert item in collection, '%r not in %r' % (item, collection)

if not hasattr(nt, 'assert_in'):
    nt.assert_in = assert_in

def assert_not_in(item, collection):
    assert item not in collection, '%r in %r' % (item, collection)

if not hasattr(nt, 'assert_not_in'):
    nt.assert_not_in = assert_not_in