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


Python six.assertCountEqual方法代码示例

本文整理汇总了Python中six.assertCountEqual方法的典型用法代码示例。如果您正苦于以下问题:Python six.assertCountEqual方法的具体用法?Python six.assertCountEqual怎么用?Python six.assertCountEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在six的用法示例。


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

示例1: test_add

# 需要导入模块: import six [as 别名]
# 或者: from six import assertCountEqual [as 别名]
def test_add(self):
    """Test adding items."""
    store = LabelStore()
    store.add('laBel1')
    six.assertCountEqual(self, ['laBel1'], store)
    six.assertCountEqual(self, ['laBel1'], store.added)
    six.assertCountEqual(self, [], store.removed)

    store.add('label2')
    six.assertCountEqual(self, ['laBel1', 'label2'], store)
    six.assertCountEqual(self, ['laBel1', 'label2'], store.added)
    six.assertCountEqual(self, [], store.removed)

    store.add('labEl2')
    six.assertCountEqual(self, ['laBel1', 'labEl2'], store)
    six.assertCountEqual(self, ['laBel1', 'labEl2'], store.added)
    six.assertCountEqual(self, [], store.removed) 
开发者ID:google,项目名称:clusterfuzz,代码行数:19,代码来源:issue_tracker_test.py

示例2: test_remove

# 需要导入模块: import six [as 别名]
# 或者: from six import assertCountEqual [as 别名]
def test_remove(self):
    """Test removing items."""
    store = LabelStore(['laBel1', 'label2', 'Label3'])
    store.remove('Label1')
    six.assertCountEqual(self, ['label2', 'Label3'], store)
    six.assertCountEqual(self, [], store.added)
    six.assertCountEqual(self, ['Label1'], store.removed)

    store.remove('Label2')
    six.assertCountEqual(self, ['Label3'], store)
    six.assertCountEqual(self, [], store.added)
    six.assertCountEqual(self, ['Label1', 'Label2'], store.removed)

    store.remove('LaBel2')
    six.assertCountEqual(self, ['Label3'], store)
    six.assertCountEqual(self, [], store.added)
    six.assertCountEqual(self, ['Label1', 'Label2'], store.removed)

    store.remove('Label4')
    six.assertCountEqual(self, ['Label3'], store)
    six.assertCountEqual(self, [], store.added)
    six.assertCountEqual(self, ['Label1', 'Label2'], store.removed) 
开发者ID:google,项目名称:clusterfuzz,代码行数:24,代码来源:issue_tracker_test.py

示例3: test_add_and_remove

# 需要导入模块: import six [as 别名]
# 或者: from six import assertCountEqual [as 别名]
def test_add_and_remove(self):
    """Test both adding and removing."""
    store = LabelStore(['laBel1', 'label2', 'Label3'])
    store.remove('Label1')
    six.assertCountEqual(self, ['label2', 'Label3'], store)
    six.assertCountEqual(self, [], store.added)
    six.assertCountEqual(self, ['Label1'], store.removed)

    store.add('label1')
    six.assertCountEqual(self, ['label1', 'label2', 'Label3'], store)
    six.assertCountEqual(self, [], store.added)
    six.assertCountEqual(self, [], store.removed)

    store.remove('Label1')
    store.add('label4')
    six.assertCountEqual(self, ['label2', 'Label3', 'label4'], store)
    six.assertCountEqual(self, ['label4'], store.added)
    six.assertCountEqual(self, ['Label1'], store.removed) 
开发者ID:google,项目名称:clusterfuzz,代码行数:20,代码来源:issue_tracker_test.py

示例4: test_component_add_label

# 需要导入模块: import six [as 别名]
# 或者: from six import assertCountEqual [as 别名]
def test_component_add_label(self):
    """Test that we set labels for component builds."""
    self.testcase.job_type = 'job'
    self.testcase.impact_stable_version = 'Stable'
    self.testcase.impact_beta_version = 'Beta'
    self.testcase.put()

    data_types.Job(
        name='job',
        environment_string=(
            'RELEASE_BUILD_BUCKET_PATH = '
            'https://example.com/blah-v8-component-([0-9]+).zip\n')).put()

    self.testcase.is_impact_set_flag = True
    mock_issue = self._make_mock_issue()
    issue_filer.update_issue_impact_labels(self.testcase, mock_issue)
    six.assertCountEqual(self, ['Security_Impact-Stable'],
                         mock_issue.labels.added)
    six.assertCountEqual(self, [], mock_issue.labels.removed) 
开发者ID:google,项目名称:clusterfuzz,代码行数:21,代码来源:issue_filer_test.py

示例5: test_only_add_five_random_ccs

# 需要导入模块: import six [as 别名]
# 或者: from six import assertCountEqual [as 别名]
def test_only_add_five_random_ccs(self):
    """Test that up to 5 random ccs are added. """
    issue_owners = ['dev%s@example.com' % idx for idx in range(100)]
    self.testcase.set_metadata('issue_owners', ','.join(issue_owners))

    helpers.patch(self, ['random.sample'])
    self.mock.sample.side_effect = lambda l, size: l[-size:]
    cleanup.update_issue_ccs_from_owners_file(self.policy, self.testcase,
                                              self.issue)
    self.assertEqual(
        'Automatically adding ccs based on OWNERS file / target commit history.'
        '\n\nIf this is incorrect, please add the ClusterFuzz-Wrong label.',
        self.issue._monorail_issue.comment)

    six.assertCountEqual(self, issue_owners[-5:], self.issue.ccs)
    self.assertIn('ClusterFuzz-Auto-CC', self.issue.labels) 
开发者ID:google,项目名称:clusterfuzz,代码行数:18,代码来源:cleanup_test.py

示例6: test_list_topics

# 需要导入模块: import six [as 别名]
# 或者: from six import assertCountEqual [as 别名]
def test_list_topics(self):
    """Test listing topics."""
    expected = []
    for i in range(5):
      topic = pubsub.topic_name(PROJECT_NAME, 'topic-{}'.format(i))
      expected.append(topic)
      self.client.create_topic(topic)

    expected.append('projects/fake-project/topics/test-topic')

    topics = list(self.client.list_topics('projects/' + PROJECT_NAME))
    six.assertCountEqual(self, expected, topics)

    # Note: Page size appears to be ignored by the emulator. Even when creating
    # large amounts of topics to force paging, the nextPageToken returned is
    # buggy and results in infinite loops.
    topics = list(
        self.client.list_topics('projects/' + PROJECT_NAME, page_size=1))
    six.assertCountEqual(self, expected, topics) 
开发者ID:google,项目名称:clusterfuzz,代码行数:21,代码来源:pubsub_test.py

示例7: test_get_libfuzzer_flags

# 需要导入模块: import six [as 别名]
# 或者: from six import assertCountEqual [as 别名]
def test_get_libfuzzer_flags(self):
    """Test get_libfuzzer_flags logic."""
    fuzz_target = data_handler.get_fuzz_target('libFuzzer_test_fuzzer')
    context = corpus_pruning_task.Context(
        fuzz_target, [], corpus_pruning_task.Pollination.RANDOM, None)

    runner = corpus_pruning_task.Runner(self.build_dir, context)
    flags = runner.get_libfuzzer_flags()
    expected_default_flags = [
        '-timeout=5', '-rss_limit_mb=2560', '-max_len=5242880',
        '-detect_leaks=1', '-use_value_profile=1'
    ]
    six.assertCountEqual(self, flags, expected_default_flags)

    runner.fuzzer_options = options.FuzzerOptions(
        os.path.join(self.build_dir, 'test_get_libfuzzer_flags.options'))
    flags = runner.get_libfuzzer_flags()
    expected_custom_flags = [
        '-timeout=5', '-rss_limit_mb=2560', '-max_len=1337', '-detect_leaks=0',
        '-use_value_profile=1'
    ]
    six.assertCountEqual(self, flags, expected_custom_flags) 
开发者ID:google,项目名称:clusterfuzz,代码行数:24,代码来源:corpus_pruning_task_test.py

示例8: test_prune

# 需要导入模块: import six [as 别名]
# 或者: from six import assertCountEqual [as 别名]
def test_prune(self):
    """Basic pruning test."""
    self.corpus_dir = self.fuchsia_corpus_dir
    corpus_pruning_task.execute_task(
        'libFuzzer_fuchsia_example-fuzzers-trap_fuzzer',
        'libfuzzer_asan_fuchsia')
    corpus = os.listdir(self.corpus_dir)
    self.assertEqual(2, len(corpus))
    six.assertCountEqual(self, [
        '801c34269f74ed383fc97de33604b8a905adb635',
        '7cf184f4c67ad58283ecb19349720b0cae756829'
    ], corpus)
    quarantine = os.listdir(self.quarantine_dir)
    self.assertEqual(1, len(quarantine))
    six.assertCountEqual(
        self, ['crash-7a8dc3985d2a90fb6e62e94910fc11d31949c348'], quarantine) 
开发者ID:google,项目名称:clusterfuzz,代码行数:18,代码来源:corpus_pruning_task_test.py

示例9: test_prepare

# 需要导入模块: import six [as 别名]
# 或者: from six import assertCountEqual [as 别名]
def test_prepare(self):
    """Test prepare."""
    engine_impl = engine.LibFuzzerEngine()
    options = engine_impl.prepare('/corpus_dir', '/path/target', '/path')
    self.assertEqual('/corpus_dir', options.corpus_dir)
    six.assertCountEqual(self, [
        '-max_len=31337', '-timeout=11', '-rss_limit_mb=2560', '-arg1',
        '-dict=/path/blah.dict'
    ], options.arguments)
    self.assertDictEqual({
        'value_profile': 1,
        'corpus_subset': 20,
        'fork': 2
    }, options.strategies)
    six.assertCountEqual(self, ['/new_corpus_dir', '/corpus_dir'],
                         options.fuzz_corpus_dirs)
    self.assertDictEqual({'extra_env': '1'}, options.extra_env)
    self.assertFalse(options.use_dataflow_tracing)
    self.assertTrue(options.is_mutations_run)

    self.mock.unpack_seed_corpus_if_needed.assert_called_with(
        '/path/target', '/corpus_dir') 
开发者ID:google,项目名称:clusterfuzz,代码行数:24,代码来源:engine_test.py

示例10: test_list_files

# 需要导入模块: import six [as 别名]
# 或者: from six import assertCountEqual [as 别名]
def test_list_files(self):
    """Tests remote list_files."""
    fuzz_inputs = file_host.rebase_to_worker_root(os.environ['FUZZ_INPUTS'])

    with open(os.path.join(fuzz_inputs, 'a'), 'w') as f:
      f.write('')

    with open(os.path.join(fuzz_inputs, 'b'), 'w') as f:
      f.write('')

    os.mkdir(os.path.join(fuzz_inputs, 'c'))
    with open(os.path.join(fuzz_inputs, 'c', 'c'), 'w') as f:
      f.write('')

    six.assertCountEqual(self, [
        os.path.join(fuzz_inputs, 'a'),
        os.path.join(fuzz_inputs, 'b'),
        os.path.join(fuzz_inputs, 'c'),
    ], file_host.list_files(fuzz_inputs))

    six.assertCountEqual(self, [
        os.path.join(fuzz_inputs, 'a'),
        os.path.join(fuzz_inputs, 'b'),
        os.path.join(fuzz_inputs, 'c', 'c'),
    ], file_host.list_files(fuzz_inputs, recursive=True)) 
开发者ID:google,项目名称:clusterfuzz,代码行数:27,代码来源:untrusted_runner_integration_test.py

示例11: test_corpus_sync

# 需要导入模块: import six [as 别名]
# 或者: from six import assertCountEqual [as 别名]
def test_corpus_sync(self):
    """Test syncing corpus."""
    environment.set_value('CORPUS_BUCKET', 'clusterfuzz-test-data')
    corpus = corpus_manager.RemoteFuzzTargetCorpus('corpus_test_fuzzer',
                                                   'child_fuzzer')
    worker_root = environment.get_value('WORKER_ROOT_DIR')
    test_corpus_directory = os.path.join(worker_root, 'corpus')
    os.mkdir(test_corpus_directory)

    try:
      self.assertTrue(corpus.rsync_to_disk(test_corpus_directory))
      six.assertCountEqual(self, os.listdir(test_corpus_directory),
                           ['123', '456', 'abc'])
    finally:
      if os.path.exists(test_corpus_directory):
        shutil.rmtree(test_corpus_directory, ignore_errors=True) 
开发者ID:google,项目名称:clusterfuzz,代码行数:18,代码来源:untrusted_runner_integration_test.py

示例12: test_dependency

# 需要导入模块: import six [as 别名]
# 或者: from six import assertCountEqual [as 别名]
def test_dependency(self):
        two_towers = """{
            "name" : "test",
            "layers" : {
                "data": {
                    "parents": []
                },
                "conv1": {
                    "parents": ["data"]
                },
                "conv2": {
                    "parents": ["data"]
                },
                "output": {
                    "parents" : ["conv1", "conv2"]
                }
            }
        }
        """
        self.graph.load_from_string(two_towers)
        nested_list = self._to_strings(self.graph.nested_list)
        self.assertEqual(nested_list[0], 'data')
        six.assertCountEqual(self, nested_list[1], (['conv1'], ['conv2']))
        self.assertEqual(nested_list[2], 'output') 
开发者ID:TalwalkarLab,项目名称:paleo,代码行数:26,代码来源:graph_test.py

示例13: test_dependency2

# 需要导入模块: import six [as 别名]
# 或者: from six import assertCountEqual [as 别名]
def test_dependency2(self):
        two_towers = """{
            "name" : "test",
            "layers" : {
                "data": {
                    "parents": []
                },
                "conv1": {
                    "parents": ["data"]
                },
                "output": {
                    "parents" : ["data", "conv1"]
                }
            }
        }
        """
        self.graph.load_from_string(two_towers)
        nested_list = self._to_strings(self.graph.nested_list)
        self.assertEqual(nested_list[0], 'data')
        six.assertCountEqual(self, nested_list[1], (['conv1'], ))
        self.assertEqual(nested_list[2], 'output') 
开发者ID:TalwalkarLab,项目名称:paleo,代码行数:23,代码来源:graph_test.py

示例14: test_log_file_json

# 需要导入模块: import six [as 别名]
# 或者: from six import assertCountEqual [as 别名]
def test_log_file_json(self):
        self.logger._get_time = MagicMock(return_value='2015-11-12T10:11:12.0Z')
        self.logger.info("Test log")
        with open(self.test_file + '.log', 'r') as f:
            read_data = f.read()
            the_dict = json.loads(read_data)
            six.assertCountEqual(self, the_dict, {
                "message": "Test log",
                "level": "INFO",
                "logger":"test",
                "timestamp":"2015-11-12T10:11:12.0Z"}) 
开发者ID:istresearch,项目名称:scrapy-cluster,代码行数:13,代码来源:test_log_factory.py

示例15: test_load_string

# 需要导入模块: import six [as 别名]
# 或者: from six import assertCountEqual [as 别名]
def test_load_string(self):
        s = """STRING = \"my stuff\"\nMY_STRING = \"cool\"\nNEW_LIST = [\'item2\']"""

        real = {
            'STRING': 'my stuff',
            'MY_STRING': 'cool',
            'NEW_LIST': ['item2']
        }

        sets = self.wrapper.load_from_string(s)
        six.assertCountEqual(self, real, sets) 
开发者ID:istresearch,项目名称:scrapy-cluster,代码行数:13,代码来源:test_settings_wrapper.py


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