Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /randovania_randovania /test /layout /test_hint_configuration.py
| from __future__ import annotations | |
| import typing | |
| from typing import TypeVar | |
| import pytest | |
| from frozendict import frozendict | |
| from randovania.bitpacking import bitpacking | |
| from randovania.bitpacking.bitpacking import BitPackDecoder | |
| from randovania.layout.base.hint_configuration import HintConfiguration, SpecificPickupHintMode | |
| T = TypeVar("T") | |
| def hint_config_with_data(request, default_echoes_configuration): | |
| data = typing.cast("dict", default_echoes_configuration.hints.as_json) | |
| reference = HintConfiguration.from_json(data) | |
| specific_pickup = dict(data["specific_pickup_hints"]) | |
| specific_pickup["sky_temple_keys"] = request.param["sky_temple_keys"] | |
| data["specific_pickup_hints"] = frozendict(specific_pickup) | |
| return ( | |
| typing.cast("bytes", request.param["encoded"]), | |
| HintConfiguration.from_json(data), | |
| data, | |
| reference, | |
| ) | |
| def test_decode(hint_config_with_data): | |
| # Setup | |
| data, expected, _, reference = hint_config_with_data | |
| # Run | |
| decoder = BitPackDecoder(data) | |
| result = HintConfiguration.bit_pack_unpack(decoder, {"reference": reference}) | |
| # Assert | |
| assert result == expected | |
| def test_encode(hint_config_with_data): | |
| # Setup | |
| expected, value, expected_json, reference = hint_config_with_data | |
| # Run | |
| result = bitpacking.pack_value(value, {"reference": reference}) | |
| as_json = value.as_json | |
| # Assert | |
| assert result == expected | |
| assert as_json == expected_json | |
Xet Storage Details
- Size:
- 1.89 kB
- Xet hash:
- e503a5899d53e1822500fac9ad92139ffa3559f61c54e57b7284f77087cd6172
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.