コード例 #1
0
    def test_clear_all_values(self):
        sb = StatBook('test_sb')

        ms1 = MultiStat(name='test_stat1')
        ms1.clear_all_values = MagicMock()

        ms2 = MultiStat(name='test_stat2')
        ms2.clear_all_values = MagicMock()

        sb.add_multi_stat(ms1)
        sb.add_multi_stat(ms2)

        sb.clear_all_values()

        ms1.clear_all_values.assert_called_once()
        ms2.clear_all_values.assert_called_once()
コード例 #2
0
    def test_clear_all_values(self):
        ms = MultiStat('test_ms')
        stat_1 = Statistic('name1')
        stat_1.clear = MagicMock()
        stat_2 = Statistic('name2')
        stat_2.clear = MagicMock()
        stat_3 = Statistic('name3')
        stat_3.clear = MagicMock()
        ms.add_statistic(stat_1)
        ms.add_statistic(stat_2)
        ms.add_statistic(stat_3)

        ms.clear_all_values()
        stat_1.clear.assert_called_once()
        stat_2.clear.assert_called_once()
        stat_3.clear.assert_called_once()