Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /randovania_randovania /test /lib /test_construct_lib.py
| import construct | |
| import pytest | |
| from construct import Construct, CString, Default, Int32ul, Struct | |
| from randovania.lib.construct_lib import DefaultsAdapter | |
| def test_defaults_adapter_bad_subcon(subcon: Construct): | |
| with pytest.raises(TypeError, match=f"subcon should be a Struct; got {type(subcon)}"): | |
| DefaultsAdapter(subcon) | |
| def defaults_adapter() -> DefaultsAdapter: | |
| return DefaultsAdapter( | |
| Struct( | |
| foo=Int32ul, | |
| bar=Default(Int32ul, 2403), | |
| ) | |
| ) | |
| DEFAULTS_ADAPTER_DATA = [ | |
| ({"foo": 0, "bar": 0}, {"foo": 0, "bar": 0}), | |
| ({"foo": 2403, "bar": 2403}, {"foo": 2403}), | |
| ] | |
| def test_defaults_adapter_encode(data_encoded: dict, data_decoded: dict, defaults_adapter): | |
| encoded = defaults_adapter._encode(data_decoded, construct.Container(), "") | |
| assert encoded == data_encoded | |
| def test_defaults_adapter_decode(data_encoded: dict, data_decoded: dict, defaults_adapter): | |
| decoded = defaults_adapter._decode(data_encoded, construct.Container(), "") | |
| assert decoded == data_decoded | |
Xet Storage Details
- Size:
- 1.29 kB
- Xet hash:
- ea7cbb13c7e076a8b0ab86070b2db0ea032713d0f6f687232c90eea9c9adb4be
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.