• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tools.assert_set_equal函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_Cases_prop_crossselect3

def test_Cases_prop_crossselect3():
    """Check (difference) output of select method; single nplies and ps."""
    actual = cases2a.select(nplies=4, ps=3, how="difference")
    expected1 = cases2a.select(ps=3) - cases2a.select(nplies=4)
    expected2 = set(cases2b3.LMs[:-1])
    nt.assert_set_equal(actual, expected1)
    nt.assert_set_equal(actual, expected2)
开发者ID:par2,项目名称:lamana-test,代码行数:7,代码来源:test_distributions.py


示例2: test_resume_load_incomplete

def test_resume_load_incomplete():
    """backends.json._resume: loads incomplete results.

    Because resume, aggregate, and summary all use the function called _resume
    we can't remove incomplete tests here. It's probably worth doing a refactor
    to split some code out and allow this to be done in the resume path.

    """
    with utils.nose.tempdir() as f:
        backend = backends.json.JSONBackend(f)
        backend.initialize(BACKEND_INITIAL_META)
        with backend.write_test("group1/test1") as t:
            t(results.TestResult('fail'))
        with backend.write_test("group1/test2") as t:
            t(results.TestResult('pass'))
        with backend.write_test("group2/test3") as t:
            t(results.TestResult('crash'))
        with backend.write_test("group2/test4") as t:
            t(results.TestResult('incomplete'))

        test = backends.json._resume(f)

        nt.assert_set_equal(
            set(test.tests.keys()),
            set(['group1/test1', 'group1/test2', 'group2/test3',
                 'group2/test4']),
        )
开发者ID:rib,项目名称:piglit,代码行数:27,代码来源:json_backend_tests.py


示例3: test_Cases_prop_crossselect6

def test_Cases_prop_crossselect6():
    """Check (intersection) output of select method; multiple nplies and ps."""
    actual = cases2a.select(nplies=[2, 4], ps=[3, 4], how="intersection")
    expected1 = {
        LM for LM in it.chain(cases2b2.LMs, cases2b3.LMs, cases2b4.LMs) if (LM.nplies in (2, 4)) & (LM.p in (3, 4))
    }
    nt.assert_set_equal(actual, expected1)
开发者ID:par2,项目名称:lamana-test,代码行数:7,代码来源:test_distributions.py


示例4: test_add_multiple_groups

def test_add_multiple_groups():
    fields = ModelDataFields()
    fields.new_field_location("node", 12)
    fields.new_field_location("cell", 2)
    fields.new_field_location("face", 7)
    fields.new_field_location("link", 7)
    assert_set_equal(set(["node", "cell", "face", "link"]), fields.groups)
开发者ID:ericthred,项目名称:landlab,代码行数:7,代码来源:test_grouped_fields.py


示例5: test_asyncio_engine

    def test_asyncio_engine(self):
        req_resp_midlleware = RequestResponseMiddleware(
            prefix_url=self.httpd.location,
            request_factory=lambda x: x,
        )

        collect_middleware = CollectRequestResponseMiddleware()

        downloader = AiohttpDownloader(
            middlewares=[AiohttpAdapterMiddleware(), collect_middleware]
        )

        downloader.middlewares.insert(0, req_resp_midlleware)

        pomp = AioPomp(
            downloader=downloader,
            pipelines=[],
        )

        class Crawler(DummyCrawler):
            ENTRY_REQUESTS = '/root'

        loop = asyncio.get_event_loop()
        loop.run_until_complete(ensure_future(pomp.pump(Crawler())))
        loop.close()

        assert_set_equal(
            set([r.url.replace(self.httpd.location, '')
                for r in collect_middleware.requests]),
            set(self.httpd.sitemap.keys())
        )
开发者ID:danielnaab,项目名称:pomp,代码行数:31,代码来源:test_contrib_asynciotools.py


示例6: check_files_applying_sort

def check_files_applying_sort(ref_file,test_file,infmt,outfmt):
    opener, args = _reader_funcs[outfmt]
    ref_transcripts  = sorted(list(opener(open(ref_file),**args)))
    test_transcripts = sorted(list(opener(open(test_file),**args)))
    
    assert_equal(len(ref_transcripts),len(test_transcripts),"%s to %s: Length mismatch in discovered transcripts. Expected '%s'. Found '%s'" % (infmt,outfmt,len(ref_transcripts),
                                                                                                                                  len(test_transcripts)))
    for tx1, tx2 in zip(ref_transcripts,test_transcripts):
        assert_equal(tx1.get_name(),tx2.get_name(),"%s to %s: Found unordered transcripts. Expected '%s'. Found '%s"'' %(infmt,outfmt,tx1.get_name(),tx2.get_name()))
        
        set1 = tx1.get_position_set()
        set2 = tx2.get_position_set()
        assert_set_equal(set1,set2,"%s to %s: Difference in position sets. Expected '%s'. Found '%s'" % (infmt,outfmt,set1,set2))

        ref_score   = str(_default_scores[(infmt,outfmt)])
        found_score = str(tx2.attr["score"])
        assert_equal(found_score,ref_score,"%s to %s: Did not find expected score. Expected: '%s'. Found '%s'" % (infmt,outfmt,ref_score,found_score))

        # BED preserves fewer attributes than GTF, so we can only test on common keys
        # We exclude "gene_id" for BEd and BigBed input because this will not match 
        # We exclude "score" because we already tested it
        #
        # by testing attr we are also implicitly testing cds_genome_end and cds_genome_start
        attr1 = tx1.attr
        attr2 = tx2.attr
        keyset = set(attr1.keys()) & set(attr2.keys()) - { "score" }
        if infmt in ("BED","BigBed") and outfmt != "BED":
            keyset -= { "gene_id" }
            
        for k in keyset:
            assert_equal(attr1[k],attr2[k],"%s to %s: Difference in attribute %s. Expected '%s'. Found '%s'" % (infmt,outfmt,k,attr1[k],attr2[k]))
开发者ID:joshuagryphon,项目名称:plastid,代码行数:31,代码来源:test_reformat_transcripts.py


示例7: test_raw_kdtree_segment_searcher_cmp

def test_raw_kdtree_segment_searcher_cmp():
    start_range = np.array([[-10, -10], [90, 90]], dtype=float)
    length_mean = 10
    length_std = 20
    num_segs = 100
    
    segments = gen_rand_segments(start_range, length_mean, length_std, num_segs)
    raw_searcher = RawSegmentSearcher().setup(segments=segments)
    kd_searcher = KDTreeSegmentSearcher().setup(segments=segments)
    
    pts_num = 200
    pts = rand_coords(start_range, pts_num)
    rads = rand_coords(np.array([[5], [60]], dtype=float), pts_num)
    
    eps = 1e-6
    for pt, rad in zip(pts, rads):
        raw_indes = raw_searcher.search_indes(pt, rad, eps)
        kd_indes = kd_searcher.search_indes(pt, rad, eps)
        eq_(len(raw_indes), len(kd_indes))
        assert_set_equal(set(raw_indes), set(kd_indes))
        
        raw_segs = raw_searcher.search(pt, rad, eps)
        kd_segs = kd_searcher.search(pt, rad, eps)
        eq_(len(raw_segs), len(kd_segs))
        assert_set_equal(set(raw_segs), set(kd_segs))
开发者ID:epsilony,项目名称:pymfr,代码行数:25,代码来源:test_searcher.py


示例8: test_dedupe

def test_dedupe():
    observed = _dedupe({('a',),
        ('a','b'),('b','c'), ('a','c'),
        ('a','b','c'),
    })
    expected = {('a',), ('b','c')}
    n.assert_set_equal(observed, expected)
开发者ID:tlevine,项目名称:special_snowflake,代码行数:7,代码来源:test_fromdicts.py


示例9: test_read_refs_into_cache_set_associative_lru

 def test_read_refs_into_cache_set_associative_lru(self):
     """read_refs_into_cache should work for set associative LRU cache"""
     refs = sim.get_addr_refs(
         word_addrs=TestReadRefs.WORD_ADDRS, num_addr_bits=8,
         num_tag_bits=5, num_index_bits=2, num_offset_bits=1)
     cache, ref_statuses = sim.read_refs_into_cache(
         refs=refs, num_sets=4, num_blocks_per_set=3,
         num_words_per_block=2, num_index_bits=2, replacement_policy='lru')
     nose.assert_dict_equal(cache, {
         '00': [
             {'tag': '01011', 'data': [88, 89]}
         ],
         '01': [
             {'tag': '00000', 'data': [2, 3]},
             {'tag': '00101', 'data': [42, 43]},
             {'tag': '10111', 'data': [186, 187]}
         ],
         '10': [
             {'tag': '10110', 'data': [180, 181]},
             {'tag': '00101', 'data': [44, 45]},
             {'tag': '11111', 'data': [252, 253]}
         ],
         '11': [
             {'tag': '10111', 'data': [190, 191]},
             {'tag': '00001', 'data': [14, 15]},
         ]
     })
     nose.assert_set_equal(self.get_hits(ref_statuses), {3, 6, 8})
开发者ID:caleb531,项目名称:cache-simulator,代码行数:28,代码来源:test_simulator_refs.py


示例10: test_urllib_downloader

    def test_urllib_downloader(self):
        req_resp_midlleware = RequestResponseMiddleware(
            prefix_url=self.httpd.location,
            request_factory=lambda x: x,
        )

        collect_middleware = CollectRequestResponseMiddleware()

        downloader = UrllibDownloader(
            middlewares=[UrllibAdapterMiddleware(), collect_middleware]
        )

        downloader.middlewares.insert(0, req_resp_midlleware)

        pomp = Pomp(
            downloader=downloader,
            pipelines=[],
        )

        class Crawler(DummyCrawler):
            ENTRY_REQUESTS = '/root'

        pomp.pump(Crawler())

        assert_set_equal(
            set([r.url.replace(self.httpd.location, '')
                for r in collect_middleware.requests]),
            set(self.httpd.sitemap.keys())
        )
开发者ID:danielnaab,项目名称:pomp,代码行数:29,代码来源:test_contrib_urllib.py


示例11: test_snow

def test_snow():
    'We should somehow find out about the status code issue.'
    with open(os.path.join('blizzard','test','fixture','budget-credits_de_paiement.p'),'rb') as fp:
        dataset = {'datasetid':8,'catalog':'foo','fields':[],'download':pickle.load(fp)}
    observed = _snow(dataset)['unique_indices']
    expected = set()
    n.assert_set_equal(observed, expected)
开发者ID:pombredanne,项目名称:blizzard,代码行数:7,代码来源:test_init.py


示例12: test_Cases_prop_crossselect2

def test_Cases_prop_crossselect2():
    """Check (intersection) output of select method; single nplies and ps."""
    actual = cases2a.select(nplies=4, ps=3, how="intersection")
    expected1 = {LM for LM in it.chain(cases2b2.LMs, cases2b3.LMs, cases2b4.LMs) if (LM.nplies == 4) & (LM.p == 3)}
    expected2 = {cases2b3.LMs[-1]}
    nt.assert_set_equal(actual, expected1)
    nt.assert_set_equal(actual, expected2)
开发者ID:par2,项目名称:lamana-test,代码行数:7,代码来源:test_distributions.py


示例13: test_user_info

    def test_user_info(self):
        client = self.get_client()
        subject = "Joe USER"
        headers = {
            HTTP_HEADER_USER_INFO: subject,
            HTTP_HEADER_SIGNATURE: ""
        }
        t = client.fetch_user_token(headers)

        nt.assert_equal(self.appId, t.validity.issuedTo)
        nt.assert_equal(self.appId, t.validity.issuedFor)
        nt.assert_equal(subject, t.tokenPrincipal.principal)
        nt.assert_equal("Joe User", t.tokenPrincipal.name)
        nt.assert_set_equal({'A', 'B', 'C'}, t.authorizations.formalAuthorizations)
        nt.assert_equal("EzBake", t.organization)
        nt.assert_equal("USA", t.citizenship)
        nt.assert_equal("low", t.authorizationLevel)
        nt.assert_dict_equal(dict([
            ('EzBake', ['Core']),
            ('42six', ['Dev', 'Emp']),
            ('Nothing', ['groups', 'group2'])]), t.externalProjectGroups)
        community_membership = t.externalCommunities['EzBake']
        nt.assert_equal("office", community_membership.type)
        nt.assert_equal("EzBake", community_membership.organization)
        nt.assert_true(community_membership.flags['ACIP'])
        nt.assert_list_equal(['topic1', 'topic2'], community_membership.topics)
        nt.assert_list_equal(['region1', 'region2', 'region3'], community_membership.regions)
        nt.assert_list_equal([], community_membership.groups)
开发者ID:crawlik,项目名称:ezbake-common-python,代码行数:28,代码来源:test_client_2.py


示例14: test_Cases_prop_crossselect1

def test_Cases_prop_crossselect1():
    """Check (union) output of select method; single nplies and ps."""
    actual1 = cases2a.select(nplies=4, ps=3)
    actual2 = cases2a.select(nplies=4, ps=3, how="union")
    expected = {LM for LM in it.chain(cases2b2.LMs, cases2b3.LMs, cases2b4.LMs) if (LM.nplies == 4) | (LM.p == 3)}
    nt.assert_set_equal(actual1, expected)
    nt.assert_set_equal(actual2, expected)
开发者ID:par2,项目名称:lamana-test,代码行数:7,代码来源:test_distributions.py


示例15: test_kdtree_raw_comp_nodes_searcher

def test_kdtree_raw_comp_nodes_searcher():
    nodes_size = 100
    coords = np.random.rand(nodes_size, 2)
    coords[:, 0] = -2 + coords[:, 0] * 9
    coords[:, 1] = -4 + coords[:, 0] * 9
    
    nodes = [MockNode(coord) for coord in coords]
    kd_searcher = KDTreeNodeSearcher().setup(nodes=nodes)
    raw_searcher = RawNodeSearcher().setup(nodes=nodes)
    
    
    xs_size = 20
    xs = np.random.rand(xs_size, 2)
    xs[:, 0] = -2 + xs[:, 0] * 9
    xs[:, 1] = -4 + xs[:, 1] * 9
    
    rads = np.random.rand(xs_size) * 5
    
    for x, rad in zip(xs, rads):
        kd_indes = kd_searcher.search_indes(x, rad)
        raw_indes = raw_searcher.search_indes(x, rad)
        assert_set_equal(set(kd_indes), set(raw_indes))
        
        kd_nodes = kd_searcher.search(x, rad)
        raw_nodes = raw_searcher.search(x, rad)
        eq_(len(kd_nodes), len(raw_nodes))
        assert_set_equal(set(kd_nodes), set(raw_nodes))
开发者ID:epsilony,项目名称:pymfr,代码行数:27,代码来源:test_searcher.py


示例16: test_visible_support_domain_searcher

def test_visible_support_domain_searcher():
    data = _visible_support_domain_data()
    x_bnd_exp_s = data['x_bnd_exp_s']
    searcher = data['searcher']
    for x, bnd, exp in x_bnd_exp_s:
        act = searcher.search_indes(x, bnd)
        eq_(len(exp), len(act))
        assert_set_equal(set(exp), set(act))
开发者ID:epsilony,项目名称:pymfr,代码行数:8,代码来源:test_searcher.py


示例17: test_parallelize_spawns_processes_and_gets_correct_ansswer

def test_parallelize_spawns_processes_and_gets_correct_ansswer():
    x = range(500)
    my_func = parallelize(util_func)
    outer_vals, outer_pids = zip(*[util_func(X) for X in x])
    inner_vals, inner_pids = zip(*my_func(x))

    assert_set_equal(set(outer_vals),set(inner_vals))
    assert_not_equal(set(outer_pids),set(inner_pids))
开发者ID:joshuagryphon,项目名称:plastid,代码行数:8,代码来源:test_decorators.py


示例18: test_main

def test_main(out, get_matches, transform_data):
    """should accept input and produce correct output when run from CLI"""
    player.main()
    transform_data.assert_called_once_with({'cards': []})
    output = out.getvalue()
    nose.assert_equal(output, output.strip())
    match = set(json.loads(output))
    nose.assert_set_equal(match, {'hbu', 'kca', 'pto'})
开发者ID:caleb531,项目名称:three-of-a-crime,代码行数:8,代码来源:test_player.py


示例19: test_duplicate_floor_requests

def test_duplicate_floor_requests():
    """should gracefully ignore duplicate floor requests"""
    elevator = Elevator(num_floors=5, starting_floor=1)
    elevator.request_floor(3)
    elevator.request_floor(3)
    nose.assert_set_equal(elevator.requested_floors, {3})
    elevator.travel()
    nose.assert_list_equal(elevator.visited_floors, [3])
开发者ID:caleb531,项目名称:elevator,代码行数:8,代码来源:tests.py


示例20: test_init

 def test_init(self):
     n.assert_set_equal(set(self.db.file_numbers.values()), {0})
     self.db.disk['file_numbers'].insert({'file_number':442})
     self.db.disk['file_numbers'].insert({'file_number':442})
     self.db.disk['file_numbers'].insert({'file_number':442})
     self.db.disk['file_numbers'].insert({'file_number':8})
     self.db._init_cache()
     n.assert_set_equal(set(self.db.file_numbers.values()), {3,1,0})
开发者ID:tlevine,项目名称:delaware,代码行数:8,代码来源:test_db.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tools.assert_true函数代码示例发布时间:2022-05-27
下一篇:
Python tools.assert_sequence_equal函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap