From 59c2faf3e6d3f008536375d3eee70356b0618255 Mon Sep 17 00:00:00 2001 From: vgorkavenko Date: Mon, 16 Sep 2024 12:10:40 +0200 Subject: [PATCH] fix: review --- src/modules/csm/csm.py | 2 +- tests/modules/csm/test_csm_module.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/csm/csm.py b/src/modules/csm/csm.py index af5b58930..269a01f54 100644 --- a/src/modules/csm/csm.py +++ b/src/modules/csm/csm.py @@ -178,7 +178,7 @@ def collect_data(self, blockstamp: BlockStamp) -> bool: self.state.migrate(l_epoch, r_epoch) self.state.log_progress() - if self.state.is_fulfilled is True: + if self.state.is_fulfilled: logger.info({"msg": "All epochs are already processed. Nothing to collect"}) return True diff --git a/tests/modules/csm/test_csm_module.py b/tests/modules/csm/test_csm_module.py index 79e1910eb..f078168c3 100644 --- a/tests/modules/csm/test_csm_module.py +++ b/tests/modules/csm/test_csm_module.py @@ -480,15 +480,15 @@ def test_collect_data_fulfilled_state( migrate=Mock(), log_status=Mock(), unprocessed_epochs=list(range(0, 101)), - is_fulfilled=PropertyMock(side_effect=[False, True]), ) + type(module.state).is_fulfilled = PropertyMock(side_effect=[False, True]) module.current_frame_range = Mock(return_value=(0, 100)) module.get_blockstamp_for_report = Mock(return_value=Mock(ref_epoch=100)) with caplog.at_level(logging.DEBUG): with patch('src.modules.csm.csm.FrameCheckpointProcessor.exec', return_value=None): collected = module.collect_data(blockstamp=Mock(slot_number=640)) - assert collected + assert collected is True # assert that it is not early return from function msg = list(filter(lambda log: "All epochs are already processed. Nothing to collect" in log, caplog.messages))