def test_block_adjust_difficulty_decrease(self): self.second_block.timestamp = 10 difficulty = Block.adjust_difficulty(self.second_block, get_utcnow_timestamp()) self.assertEqual(difficulty, self.second_block.difficulty - 1)
def test_block_adjust_difficulty_set_to_one(self): self.second_block.timestamp = 1 difficulty = Block.adjust_difficulty(self.second_block, get_utcnow_timestamp()) self.assertEqual(difficulty, 1)
def test_block_adjust_difficulty_increase(self): self.second_block.timestamp = 10 difficulty = Block.adjust_difficulty(self.second_block, 1) self.assertEqual(difficulty, self.second_block.difficulty + 1)