def runTest(self):
os.environ['RANDOMSEED'] = '2'
options = get_options(['--samples', '10', '--output', 'ch13_r05_test.yaml'])
face_count = write_rolls(options.output_path, roll_iter(options.samples, options.seed))
self.assertDictEqual(
{8: 8, 7: 6, 10: 5, 4: 3, 6: 3, 9: 3, 2: 2, 3: 1, 5: 1, 11: 1, 12: 1},
face_count)
results = list(yaml.load_all(self.data_path.read_text()))
self.assertListEqual(
[[[1, 1]],
[[1, 3], [2, 6], [6, 3], [3, 5], [2, 5]],
[[1, 5], [6, 2], [4, 6], [4, 6], [5, 3], [5, 4], [5, 3], [1, 1], [3, 4]],
[[3, 4]],
[[4, 5], [2, 5]],
[[2, 2], [2, 1], [2, 3], [2, 2]],
[[5, 5], [3, 5], [6, 5], [2, 4], [4, 6]],
[[5, 3], [5, 3]],
[[3, 4]],
[[2, 4], [6, 6], [4, 6], [5, 2]]],
results)
ch13_r05.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录