def test_non_equality_of_copies_off_genesis(): validator_0 = Validator("v0", 10) validator_1 = Validator("v1", 11) block_0 = Block(None, Justification(), validator_0) block_1 = Block(None, Justification(), validator_1) assert block_0 != block_1
def test_non_equality_of_copies_off_genesis(): validator_0 = Validator("v0", 10) validator_1 = Validator("v1", 11) message_0 = Message(None, Justification(), validator_0) message_1 = Message(None, Justification(), validator_1) assert message_0 != message_1
def test_is_in_blockchain__separate_genesis(): validator_0 = Validator("v0", 10) validator_1 = Validator("v1", 11) block_0 = Block(None, Justification(), validator_0) block_1 = Block(None, Justification(), validator_1) assert not block_0.is_in_blockchain(block_1) assert not block_1.is_in_blockchain(block_0)
def test_new_message(validator): message = Message(None, Justification(), validator) assert message.sender == validator assert message.estimate is None assert not message.justification.latest_messages assert message.sequence_number == 0
def test_equality_of_copies_off_genesis(validator): block = Block(None, Justification(), validator) shallow_copy = copy.copy(block) deep_copy = copy.deepcopy(block) assert block == shallow_copy assert block == deep_copy assert shallow_copy == deep_copy
def test_equality_of_copies_off_genesis(validator): message = Message(None, Justification(), validator) shallow_copy = copy.copy(message) deep_copy = copy.deepcopy(message) assert message == shallow_copy assert message == deep_copy assert shallow_copy == deep_copy
def justification(self): """Returns the latest messages seen from other validators, to justify estimate.""" return Justification(self.latest_messages)
def test_check_estimate_safety_without_validator_set(): validator = Validator("cool", 10.2) block = Block(None, Justification(), validator) with pytest.raises(AttributeError): validator.check_estimate_safety(block)