Python nose.tools 模块,assert_is_not_none() 实例源码

我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用nose.tools.assert_is_not_none()

项目:leetcode    作者:thomasyimgit    | 项目源码 | 文件源码
def test_image_filename_defaults():
    '''test format constraint, and validity of jpeg and png'''
    tpath = ipath.get_ipython_package_dir()
    nt.assert_raises(ValueError, display.Image, filename=os.path.join(tpath, 'testing/tests/badformat.gif'),
                     embed=True)
    nt.assert_raises(ValueError, display.Image)
    nt.assert_raises(ValueError, display.Image, data='this is not an image', format='badformat', embed=True)
    # check boths paths to allow packages to test at build and install time
    imgfile = os.path.join(tpath, 'core/tests/2x2.png')
    img = display.Image(filename=imgfile)
    nt.assert_equal('png', img.format)
    nt.assert_is_not_none(img._repr_png_())
    img = display.Image(filename=os.path.join(tpath, 'testing/tests/logo.jpg'), embed=False)
    nt.assert_equal('jpeg', img.format)
    nt.assert_is_none(img._repr_jpeg_())
项目:leetcode    作者:thomasyimgit    | 项目源码 | 文件源码
def test_builtin_init():
    info = inspector.info(list)
    init_def = info['init_definition']
    # Python < 3.4 can't get init definition from builtins,
    # but still exercise the inspection in case of error-raising bugs.
    if sys.version_info >= (3,4):
        nt.assert_is_not_none(init_def)
项目:Repobot    作者:Desgard    | 项目源码 | 文件源码
def test_image_filename_defaults():
    '''test format constraint, and validity of jpeg and png'''
    tpath = ipath.get_ipython_package_dir()
    nt.assert_raises(ValueError, display.Image, filename=os.path.join(tpath, 'testing/tests/badformat.gif'),
                     embed=True)
    nt.assert_raises(ValueError, display.Image)
    nt.assert_raises(ValueError, display.Image, data='this is not an image', format='badformat', embed=True)
    # check boths paths to allow packages to test at build and install time
    imgfile = os.path.join(tpath, 'core/tests/2x2.png')
    img = display.Image(filename=imgfile)
    nt.assert_equal('png', img.format)
    nt.assert_is_not_none(img._repr_png_())
    img = display.Image(filename=os.path.join(tpath, 'testing/tests/logo.jpg'), embed=False)
    nt.assert_equal('jpeg', img.format)
    nt.assert_is_none(img._repr_jpeg_())
项目:Repobot    作者:Desgard    | 项目源码 | 文件源码
def test_builtin_init():
    info = inspector.info(list)
    init_def = info['init_definition']
    # Python < 3.4 can't get init definition from builtins,
    # but still exercise the inspection in case of error-raising bugs.
    if sys.version_info >= (3,4):
        nt.assert_is_not_none(init_def)
项目:birdseye-server    作者:DramaticLiberty    | 项目源码 | 文件源码
def assert_error(code, response):
    nt.assert_equal(response.status_code, code)
    nt.assert_equal(response.content_type, 'application/json')
    jr = json.loads(response.get_data(as_text=True))
    nt.assert_equal(jr['status'], 'error')
    nt.assert_is_not_none(jr['message'])
    return jr
项目:birdseye-server    作者:DramaticLiberty    | 项目源码 | 文件源码
def test_get_root(self):
        resp = assert_ok(200, self.client.get('/v1'))
        nt.assert_is_not_none(resp['version'])
项目:birdseye-server    作者:DramaticLiberty    | 项目源码 | 文件源码
def test_file_path_url(self):
        img_args_fp, _ = jobs.gcv_params(self.file_path)
        nt.assert_is_not_none(img_args_fp)

        img_args_url, _ = jobs.gcv_params(self.file_url)
        nt.assert_is_not_none(img_args_url)
        nt.assert_true(img_args_fp.keys() != img_args_url.keys)
项目:birdseye-server    作者:DramaticLiberty    | 项目源码 | 文件源码
def test_convert_poly(self):
        gps = jobs.detect_exif_gps(self.file_path_gps)
        gps_poly = jobs.make_poly(gps[0], gps[1], 0.00001)
        nt.assert_is_not_none(gps_poly)
        nt.assert_true(gps_poly.startswith('POLYGON('))
项目:blender    作者:gastrodia    | 项目源码 | 文件源码
def test_image_filename_defaults():
    '''test format constraint, and validity of jpeg and png'''
    tpath = ipath.get_ipython_package_dir()
    nt.assert_raises(ValueError, display.Image, filename=os.path.join(tpath, 'testing/tests/badformat.gif'),
                     embed=True)
    nt.assert_raises(ValueError, display.Image)
    nt.assert_raises(ValueError, display.Image, data='this is not an image', format='badformat', embed=True)
    # check boths paths to allow packages to test at build and install time
    imgfile = os.path.join(tpath, 'core/tests/2x2.png')
    img = display.Image(filename=imgfile)
    nt.assert_equal('png', img.format)
    nt.assert_is_not_none(img._repr_png_())
    img = display.Image(filename=os.path.join(tpath, 'testing/tests/logo.jpg'), embed=False)
    nt.assert_equal('jpeg', img.format)
    nt.assert_is_none(img._repr_jpeg_())
项目:blender    作者:gastrodia    | 项目源码 | 文件源码
def test_builtin_init():
    info = inspector.info(list)
    init_def = info['init_definition']
    # Python < 3.4 can't get init definition from builtins,
    # but still exercise the inspection in case of error-raising bugs.
    if sys.version_info >= (3,4):
        nt.assert_is_not_none(init_def)
项目:yatta_reader    作者:sound88    | 项目源码 | 文件源码
def test_image_filename_defaults():
    '''test format constraint, and validity of jpeg and png'''
    tpath = ipath.get_ipython_package_dir()
    nt.assert_raises(ValueError, display.Image, filename=os.path.join(tpath, 'testing/tests/badformat.zip'),
                     embed=True)
    nt.assert_raises(ValueError, display.Image)
    nt.assert_raises(ValueError, display.Image, data='this is not an image', format='badformat', embed=True)
    # check boths paths to allow packages to test at build and install time
    imgfile = os.path.join(tpath, 'core/tests/2x2.png')
    img = display.Image(filename=imgfile)
    nt.assert_equal('png', img.format)
    nt.assert_is_not_none(img._repr_png_())
    img = display.Image(filename=os.path.join(tpath, 'testing/tests/logo.jpg'), embed=False)
    nt.assert_equal('jpeg', img.format)
    nt.assert_is_none(img._repr_jpeg_())
项目:yatta_reader    作者:sound88    | 项目源码 | 文件源码
def test_builtin_init():
    info = inspector.info(list)
    init_def = info['init_definition']
    # Python < 3.4 can't get init definition from builtins,
    # but still exercise the inspection in case of error-raising bugs.
    if sys.version_info >= (3,4):
        nt.assert_is_not_none(init_def)