当前位置: 首页>>代码示例>>Python>>正文


Python tools.assert_not_in函数代码示例

本文整理汇总了Python中nose.tools.assert_not_in函数的典型用法代码示例。如果您正苦于以下问题:Python assert_not_in函数的具体用法?Python assert_not_in怎么用?Python assert_not_in使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了assert_not_in函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: operations_are_retried_on_refresh

def operations_are_retried_on_refresh():
    changes_store = ChangesStore()
    changes_store.try_or_save(note_store.updateNote, developer_token, note)
    note_store.updateNote.side_effect = None
    changes_store.retry_failed_operations()

    assert_not_in(operation, changes_store.saved_operations)
开发者ID:Lewix,项目名称:evernotecli,代码行数:7,代码来源:store_tests.py

示例2: test_numpy_reset_array_undec

def test_numpy_reset_array_undec():
    "Test '%reset array' functionality"
    _ip.ex('import numpy as np')
    _ip.ex('a = np.empty(2)')
    nt.assert_in('a', _ip.user_ns)
    _ip.magic('reset -f array')
    nt.assert_not_in('a', _ip.user_ns)
开发者ID:jakevdp,项目名称:ipython,代码行数:7,代码来源:test_magic.py

示例3: assert_no_completion

 def assert_no_completion(**kwargs):
     _, matches = complete(**kwargs)
     nt.assert_not_in('abc', matches)
     nt.assert_not_in('abc\'', matches)
     nt.assert_not_in('abc\']', matches)
     nt.assert_not_in('\'abc\'', matches)
     nt.assert_not_in('\'abc\']', matches)
开发者ID:Agent74,项目名称:ipython,代码行数:7,代码来源:test_completer.py

示例4: test_project_data_tools

    def test_project_data_tools(self):
        # Deny anonymous to see 'private-bugs' tool
        role = M.ProjectRole.by_name("*anonymous")._id
        read_permission = M.ACE.allow(role, "read")
        app = M.Project.query.get(shortname="test").app_instance("private-bugs")
        if read_permission in app.config.acl:
            app.config.acl.remove(read_permission)

        # admin sees both 'Tickets' tools
        r = self.app.get("/rest/p/test?doap")
        p = r.xml.find(self.ns + "Project")
        tools = p.findall(self.ns_sf + "feature")
        tools = [
            (
                t.find(self.ns_sf + "Feature").find(self.ns + "name").text,
                t.find(self.ns_sf + "Feature").find(self.foaf + "page").items()[0][1],
            )
            for t in tools
        ]
        assert_in(("Tickets", "http://localhost/p/test/bugs/"), tools)
        assert_in(("Tickets", "http://localhost/p/test/private-bugs/"), tools)

        # anonymous sees only non-private tool
        r = self.app.get("/rest/p/test?doap", extra_environ={"username": "*anonymous"})
        p = r.xml.find(self.ns + "Project")
        tools = p.findall(self.ns_sf + "feature")
        tools = [
            (
                t.find(self.ns_sf + "Feature").find(self.ns + "name").text,
                t.find(self.ns_sf + "Feature").find(self.foaf + "page").items()[0][1],
            )
            for t in tools
        ]
        assert_in(("Tickets", "http://localhost/p/test/bugs/"), tools)
        assert_not_in(("Tickets", "http://localhost/p/test/private-bugs/"), tools)
开发者ID:apache,项目名称:incubator-allura,代码行数:35,代码来源:test_rest.py

示例5: test_assert_cwd_unchanged_not_masking_exceptions

def test_assert_cwd_unchanged_not_masking_exceptions():
    # Test that we are not masking out other "more important" exceptions

    orig_cwd = os.getcwd()

    @assert_cwd_unchanged
    def do_chdir_value_error():
        os.chdir(os.pardir)
        raise ValueError("error exception")

    with swallow_logs() as cml:
        with assert_raises(ValueError) as cm:
            do_chdir_value_error()
        # retrospect exception
        if PY2:
            # could not figure out how to make it legit for PY3
            # but on manual try -- works, and exception traceback is not masked out
            exc_info = sys.exc_info()
            assert_in('raise ValueError("error exception")', traceback.format_exception(*exc_info)[-2])

        eq_(orig_cwd, os.getcwd(),
            "assert_cwd_unchanged didn't return us back to %s" % orig_cwd)
        assert_in("Mitigating and changing back", cml.out)

    # and again but allowing to chdir
    @assert_cwd_unchanged(ok_to_chdir=True)
    def do_chdir_value_error():
        os.chdir(os.pardir)
        raise ValueError("error exception")

    with swallow_logs() as cml:
        assert_raises(ValueError, do_chdir_value_error)
        eq_(orig_cwd, os.getcwd(),
            "assert_cwd_unchanged didn't return us back to %s" % orig_cwd)
        assert_not_in("Mitigating and changing back", cml.out)
开发者ID:WurstWorks,项目名称:datalad,代码行数:35,代码来源:test_tests_utils.py

示例6: test_profile_sections

    def test_profile_sections(self):
        project = Project.query.get(shortname='u/test-user')
        app = project.app_instance('profile')

        def ep(n):
            m = mock.Mock()
            m.name = n
            m.load()().display.return_value = 'Section %s' % n
            return m
        eps = map(ep, ['a', 'b', 'c', 'd'])
        order = {'user_profile_sections.order': 'b, d,c , f '}
        if hasattr(type(app), '_sections'):
            delattr(type(app), '_sections')
        with mock.patch('allura.lib.helpers.iter_entry_points') as iep:
            with mock.patch.dict(tg.config, order):
                iep.return_value = eps
                sections = app.profile_sections
                assert_equal(sections, [
                    eps[1].load(),
                    eps[3].load(),
                    eps[2].load(),
                    eps[0].load()])
        r = self.app.get('/u/test-user/profile')
        assert_in('Section a', r.body)
        assert_in('Section b', r.body)
        assert_in('Section c', r.body)
        assert_in('Section d', r.body)
        assert_not_in('Section f', r.body)
开发者ID:apache,项目名称:allura,代码行数:28,代码来源:test_user_profile.py

示例7: test_subtests_with_slash

def test_subtests_with_slash():
    """ Version 1: Subtest names with /'s are handled correctly """

    expected = 'group2/groupA/test/subtest 1'
    nt.assert_not_in(
        expected, RESULT.tests.iterkeys(),
        msg='{0} found in result, when it should not be'.format(expected))
开发者ID:aphogat,项目名称:piglit,代码行数:7,代码来源:results_v0_tests.py

示例8: test_project_data_tools

    def test_project_data_tools(self):
        # Deny anonymous to see 'private-bugs' tool
        role = M.ProjectRole.by_name('*anonymous')._id
        read_permission = M.ACE.allow(role, 'read')
        app = M.Project.query.get(
            shortname='test').app_instance('private-bugs')
        if read_permission in app.config.acl:
            app.config.acl.remove(read_permission)

        # admin sees both 'Tickets' tools
        r = self.app.get('/rest/p/test?doap')
        p = r.xml.find(self.ns + 'Project')
        tools = p.findall(self.ns_sf + 'feature')
        tools = [(t.find(self.ns_sf + 'Feature').find(self.ns + 'name').text,
                  t.find(self.ns_sf + 'Feature').find(self.foaf + 'page').items()[0][1])
                 for t in tools]
        assert_in(('Tickets', 'http://localhost/p/test/bugs/'), tools)
        assert_in(('Tickets', 'http://localhost/p/test/private-bugs/'), tools)

        # anonymous sees only non-private tool
        r = self.app.get('/rest/p/test?doap',
                         extra_environ={'username': '*anonymous'})
        p = r.xml.find(self.ns + 'Project')
        tools = p.findall(self.ns_sf + 'feature')
        tools = [(t.find(self.ns_sf + 'Feature').find(self.ns + 'name').text,
                  t.find(self.ns_sf + 'Feature').find(self.foaf + 'page').items()[0][1])
                 for t in tools]
        assert_in(('Tickets', 'http://localhost/p/test/bugs/'), tools)
        assert_not_in(('Tickets', 'http://localhost/p/test/private-bugs/'), tools)
开发者ID:abhinavthomas,项目名称:allura,代码行数:29,代码来源:test_rest.py

示例9: test_assert_cwd_unchanged_not_masking_exceptions

def test_assert_cwd_unchanged_not_masking_exceptions():
    # Test that we are not masking out other "more important" exceptions

    orig_dir = os.getcwd()

    @assert_cwd_unchanged
    def do_chdir_value_error():
        os.chdir(os.pardir)
        raise ValueError("error exception")

    with swallow_logs() as cml:
        assert_raises(ValueError, do_chdir_value_error)
        eq_(orig_dir, os.getcwd(),
            "assert_cwd_unchanged didn't return us back to %s" % orig_dir)
        assert_in("Mitigating and changing back", cml.out)


    # and again but allowing to chdir
    @assert_cwd_unchanged(ok_to_chdir=True)
    def do_chdir_value_error():
        os.chdir(os.pardir)
        raise ValueError("error exception")

    with swallow_logs() as cml:
        assert_raises(ValueError, do_chdir_value_error)
        eq_(orig_dir, os.getcwd(),
            "assert_cwd_unchanged didn't return us back to %s" % orig_dir)
        assert_not_in("Mitigating and changing back", cml.out)
开发者ID:jgors,项目名称:datalad,代码行数:28,代码来源:test_tests_utils.py

示例10: test_subtests_with_slash

    def test_subtests_with_slash(self):
        """backends.json.update_results (0 -> 1): Subtest names with /'s are handled correctly"""

        expected = 'group2/groupA/test/subtest 1'
        nt.assert_not_in(
            expected, six.iterkeys(self.RESULT.tests),
            msg='{0} found in result, when it should not be'.format(expected))
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:7,代码来源:json_results_update_tests.py

示例11: test_alias_lifecycle

def test_alias_lifecycle():
    name = 'test_alias1'
    cmd = 'echo "Hello"'
    am = _ip.alias_manager
    am.clear_aliases()
    am.define_alias(name, cmd)
    assert am.is_alias(name)
    nt.assert_equal(am.retrieve_alias(name), cmd)
    nt.assert_in((name, cmd), am.aliases)
    
    # Test running the alias
    orig_system = _ip.system
    result = []
    _ip.system = result.append
    try:
        _ip.run_cell('%{}'.format(name))
        result = [c.strip() for c in result]
        nt.assert_equal(result, [cmd])
    finally:
        _ip.system = orig_system
    
    # Test removing the alias
    am.undefine_alias(name)
    assert not am.is_alias(name)
    with nt.assert_raises(ValueError):
        am.retrieve_alias(name)
    nt.assert_not_in((name, cmd), am.aliases)
开发者ID:2t7,项目名称:ipython,代码行数:27,代码来源:test_alias.py

示例12: rm_method

def rm_method(method):
    radu = RadulaProxy(connection=boto.connect_s3())
    radu.make_bucket(subject=TEST_BUCKET)

    # give something to rm
    args = vars(_parse_args(['up']))
    expected = []
    for i in xrange(3):
        remote_file = REMOTE_FILE + str(i)
        expected.append(remote_file)
        args.update({
            "subject": TEST_FILE,
            "target": remote_file
        })
        radu.upload(**args)

    while len(expected):
        remove_file = expected.pop()
        sys.stdout.truncate(0)
        getattr(radu, method)(subject=remove_file)

        radu.keys(subject=TEST_BUCKET)
        keys = [k.strip() for k in sys.stdout.getvalue().strip().split("\n")]

        absent_key = os.path.basename(remove_file)
        assert_not_in(absent_key, keys, msg="Expecting absence of key mention '{0}'".format(absent_key))
        for expected_key in expected:
            expected_key = os.path.basename(expected_key)
            assert_in(expected_key, keys, msg="Expecting output containing '{0}'".format(expected_key))
开发者ID:magicrobotmonkey,项目名称:radula,代码行数:29,代码来源:proxy_test.py

示例13: test_add_handle_by_names

def test_add_handle_by_names(hurl, hpath, cpath, lcpath):

    class mocked_dirs:
        user_data_dir = lcpath

    with patch('datalad.cmdline.helpers.dirs', mocked_dirs), \
            swallow_logs() as cml:

        # get testrepos and make them known to datalad:
        handle = install_handle(hurl, hpath)
        collection = register_collection(cpath)
        assert_not_in(handle.name, collection)

        return_value = add_handle(handle.name, collection.name)

        # now handle is listed by collection:
        collection._reload()
        assert_in(handle.name, collection)

        # test collection repo:
        ok_clean_git(cpath, annex=False)
        ok_(isdir(opj(cpath, handle.name)))
        ok_(exists(opj(cpath, handle.name, REPO_CONFIG_FILE)))
        ok_(exists(opj(cpath, handle.name, REPO_STD_META_FILE)))

        # evaluate return value:
        assert_is_instance(return_value, Handle,
                           "install_handle() returns object of "
                           "incorrect class: %s" % type(return_value))
        eq_(return_value.name, handle.name)
        eq_(urlparse(return_value.url).path, urlparse(handle.url).path)
开发者ID:WurstWorks,项目名称:datalad,代码行数:31,代码来源:test_add_handle.py

示例14: test_remove_groups

    def test_remove_groups(self):
        """
        Test the user is removed from all the groups in the list
        """

        calculon = {
            'email': '[email protected]',
        }
        fry = {
            'email': '[email protected]',
        }

        # Create the groups by adding users to groups
        self.mock_ps.add_groups(calculon, ['group1', 'group2'])
        self.mock_ps.add_groups(fry, ['group1'])

        # Remove user from a group he doesn't belong to
        self.mock_ps.remove_groups(fry, ['group1', 'group2'])

        users = self.mock_ps.get_group('group1')
        assert_not_in('[email protected]',
                      [user['email'] for user in users])

        users = self.mock_ps.get_group('group2')
        assert_not_in('[email protected]',
                      [user['email'] for user in users])
开发者ID:infoxchange,项目名称:ixprofile-client,代码行数:26,代码来源:test_remove_groups.py

示例15: _test_post_create_service

    def _test_post_create_service(self, if_error_expected):
        with self.app.test_client():
            self.login()

        with mock.patch("app.main.views.services.data_api_client") as data_api_client:

            data_api_client.create_new_draft_service.return_value = {
                "services": {
                    "id": 1,
                    "supplierId": 1234,
                    "supplierName": "supplierName",
                    "lot": "SCS",
                    "status": "not-submitted",
                    "frameworkName": "frameworkName",
                    "links": {},
                    "updatedAt": "2015-06-29T15:26:07.650368Z",
                }
            }

            res = self.client.post("/suppliers/submission/g-cloud-7/create")

            assert_equal(res.status_code, 302)

            error_message = "?error={}".format(self._format_for_request(self._answer_required))

            if if_error_expected:
                assert_in(error_message, res.location)
            else:
                assert_not_in(error_message, res.location)
开发者ID:mtekel,项目名称:digitalmarketplace-supplier-frontend,代码行数:29,代码来源:test_services.py


注:本文中的nose.tools.assert_not_in函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。