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


Python MagicMock.starts方法代码示例

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


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

示例1: test_single_location_two_segments_uneven

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import starts [as 别名]
 def test_single_location_two_segments_uneven(self):
     mother = MagicMock()
     mother.starts = np.array([0, 5], dtype = np.uint32)
     mother.end = 20
     mother.founder = np.array([1, 2], dtype = np.uint32)
     father = MagicMock()
     father.starts = np.array([0, 10], dtype = np.uint32)
     father.end = 20
     father.founder = np.array([3, 4], dtype = np.uint32)
     locations = [(2, 11)]
     new_mother, new_father = recomb_genome._swap_at_locations(mother,
                                                               father,
                                                               locations)
     np.testing.assert_array_equal(new_mother.starts,
                                   np.array([0, 2, 10, 11],
                                            dtype = np.uint32))
     np.testing.assert_array_equal(new_mother.founder,
                                   np.array([1, 3, 4, 2],
                                            dtype = np.uint32))
     np.testing.assert_array_equal(new_father.starts,
                                   np.array([0, 2, 5, 11],
                                            dtype = np.uint32))
     np.testing.assert_array_equal(new_father.founder,
                                   np.array([3, 1, 2, 4],
                                            dtype = np.uint32))
开发者ID:romjerome,项目名称:genetic_privacy,代码行数:27,代码来源:test_recomb_genome.py

示例2: test_two_locations_at_boundary_two_segments

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import starts [as 别名]
 def test_two_locations_at_boundary_two_segments (self):
     mother = MagicMock()
     mother.starts = np.array([0, 10], dtype = np.uint32)
     mother.end = 20
     mother.founder = np.array([1, 2], dtype = np.uint32)
     father = MagicMock()
     father.starts = np.array([0, 10], dtype = np.uint32)
     father.end = 20
     father.founder = np.array([3, 4], dtype = np.uint32)
     locations = [(0, 5), (15, 20)]
     new_mother, new_father = recomb_genome._swap_at_locations(mother,
                                                               father,
                                                               locations)
     np.testing.assert_array_equal(new_mother.starts,
                                   np.array([0, 5, 10, 15],
                                            dtype = np.uint32))
     np.testing.assert_array_equal(new_mother.founder,
                                   np.array([3, 1, 2, 4],
                                            dtype = np.uint32))
     np.testing.assert_array_equal(new_father.starts,
                                   np.array([0, 5, 10, 15],
                                            dtype = np.uint32))
     np.testing.assert_array_equal(new_father.founder,
                                   np.array([1, 3, 4, 2],
                                            dtype = np.uint32))
开发者ID:romjerome,项目名称:genetic_privacy,代码行数:27,代码来源:test_recomb_genome.py

示例3: test_single_element_vs_many_match_in_front

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import starts [as 别名]
 def test_single_element_vs_many_match_in_front(self):
     a = MagicMock()
     a.starts = np.array([0], dtype = uint32)
     a.founder = np.array([0], dtype = uint32)
     a.end = 10
     b = MagicMock()
     b.starts = np.array([0, 2, 4, 8], dtype = uint32)
     b.founder = np.array([0, 2, 3, 4], dtype = uint32)
     b.end = 10
     shared = common_homolog_segments(a, b)
     self.assertEqual(shared, [(0, 2)])
开发者ID:romjerome,项目名称:genetic_privacy,代码行数:13,代码来源:test_common_segments.py

示例4: test_two_segments_different_boundary

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import starts [as 别名]
 def test_two_segments_different_boundary(self):
     a = MagicMock()
     a.starts = np.array([0, 5], dtype = uint32)
     a.founder = np.array([1, 1], dtype = uint32)
     a.end = 10
     b = MagicMock()
     b.starts = np.array([0, 6], dtype = uint32)
     b.founder = np.array([1, 1], dtype = uint32)
     b.end = 10
     shared = common_homolog_segments(a, b)
     self.assertEqual(shared, [(0, 10)])
开发者ID:romjerome,项目名称:genetic_privacy,代码行数:13,代码来源:test_common_segments.py

示例5: test_multiple_same_segment

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import starts [as 别名]
 def test_multiple_same_segment(self):
     a = MagicMock()
     a.starts = np.array([0], dtype = uint32)
     a.founder = np.array([0], dtype = uint32)
     a.end = 10
     b = MagicMock()
     b.starts = np.array([0, 5], dtype = uint32)
     b.founder = np.array([0, 0], dtype = uint32)
     b.end = 10
     shared = common_homolog_segments(a, b)
     self.assertEqual(shared, [(0, 10)])
开发者ID:romjerome,项目名称:genetic_privacy,代码行数:13,代码来源:test_common_segments.py

示例6: test_single_different_segment

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import starts [as 别名]
 def test_single_different_segment(self):
     a = MagicMock()
     a.starts = np.array([0], dtype = uint32)
     a.founder = np.array([0], dtype = uint32)
     a.end = 10
     b = MagicMock()
     b.starts = np.array([0], dtype = uint32)
     b.founder = np.array([1], dtype = uint32)
     b.end = 10
     shared = common_homolog_segments(a, b)
     self.assertEqual(shared, [])
开发者ID:romjerome,项目名称:genetic_privacy,代码行数:13,代码来源:test_common_segments.py

示例7: test_two_same_segments

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import starts [as 别名]
 def test_two_same_segments(self):
     a = MagicMock()
     a.starts = np.array([0, 5], dtype = uint32)
     a.founder = np.array([1, 2], dtype = uint32)
     a.end = 10
     shared = common_homolog_segments(a, a)
     self.assertEqual(shared, [(0, 10)])
开发者ID:romjerome,项目名称:genetic_privacy,代码行数:9,代码来源:test_common_segments.py

示例8: test_single_element_end

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import starts [as 别名]
 def test_single_element_end(self):
     diploid = MagicMock()
     diploid.starts = np.array([0], dtype = np.uint32)
     diploid.end = 10
     diploid.founder = np.array([1], dtype = np.uint32)
     ret_diploid = new_sequence(diploid, [10])
     self.assertEqual(ret_diploid.starts, [0])
     self.assertEqual(ret_diploid.founder, [1])
开发者ID:romjerome,项目名称:genetic_privacy,代码行数:10,代码来源:test_recomb_genome.py

示例9: test_middle_boundary_two_element_multiple_breaks

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import starts [as 别名]
 def test_middle_boundary_two_element_multiple_breaks(self):
     diploid = MagicMock()
     diploid.starts = np.array([0, 10], dtype = np.uint32)
     diploid.end = 20
     diploid.founder = np.array([1, 2], dtype = np.uint32)
     ret_diploid = new_sequence(diploid, [5, 15])
     self.assertEqual(ret_diploid.starts, [0, 5, 10, 15])
     self.assertEqual(ret_diploid.founder, [1, 1, 2, 2])
开发者ID:romjerome,项目名称:genetic_privacy,代码行数:10,代码来源:test_recomb_genome.py

示例10: test_start_boundary_two_element

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import starts [as 别名]
 def test_start_boundary_two_element(self):
     diploid = MagicMock()
     diploid.starts = np.array([0, 10], dtype = np.uint32)
     diploid.stops = np.array([10, 20], dtype = np.uint32)
     diploid.founder = np.array([1, 2], dtype = np.uint32)
     ret_diploid = new_sequence(diploid, [0])
     self.assertEqual(ret_diploid.starts, [0, 10])
     self.assertEqual(ret_diploid.founder, [1, 2])
开发者ID:romjerome,项目名称:genetic_privacy,代码行数:10,代码来源:test_recomb_genome.py

示例11: test_single_location_left_boundary

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import starts [as 别名]
 def test_single_location_left_boundary(self):
     mother = MagicMock()
     mother.starts = np.array([0], dtype = np.uint32)
     mother.end = 10
     mother.founder = np.array([1], dtype = np.uint32)
     father = MagicMock()
     father.starts = np.array([0], dtype = np.uint32)
     father.end = 10
     father.founder = np.array([2], dtype = np.uint32)
     locations = [(0, 5)]
     new_mother, new_father = recomb_genome._swap_at_locations(mother,
                                                               father,
                                                               locations)
     np.testing.assert_array_equal(new_mother.starts,
                                   np.array([0, 5], dtype = np.uint32))
     np.testing.assert_array_equal(new_mother.founder,
                                   np.array([2, 1], dtype = np.uint32))
     np.testing.assert_array_equal(new_father.starts,
                                   np.array([0, 5], dtype = np.uint32))
     np.testing.assert_array_equal(new_father.founder,
                                   np.array([1, 2], dtype = np.uint32))
开发者ID:romjerome,项目名称:genetic_privacy,代码行数:23,代码来源:test_recomb_genome.py

示例12: test_multiple_locations_single_segment

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import starts [as 别名]
 def test_multiple_locations_single_segment(self):
     mother = MagicMock()
     mother.starts = np.array([0], dtype = np.uint32)
     mother.end = 10
     mother.founder = np.array([1], dtype = np.uint32)
     father = MagicMock()
     father.starts = np.array([0], dtype = np.uint32)
     father.end = 10
     father.founder = np.array([2], dtype = np.uint32)
     locations = [(0, 4), (6, 10)]
     new_mother, new_father = recomb_genome._swap_at_locations(mother,
                                                               father,
                                                               locations)
     np.testing.assert_array_equal(new_mother.starts,
                                   np.array([0, 4, 6], dtype = np.uint32))
     np.testing.assert_array_equal(new_mother.founder,
                                   np.array([2, 1, 2], dtype = np.uint32))
     np.testing.assert_array_equal(new_father.starts,
                                   np.array([0, 4, 6], dtype = np.uint32))
     np.testing.assert_array_equal(new_father.founder,
                                   np.array([1, 2, 1], dtype = np.uint32))
开发者ID:romjerome,项目名称:genetic_privacy,代码行数:23,代码来源:test_recomb_genome.py


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