Example #1
0
def test_serialize_fields(option: Options):
    # Setup

    # Run
    result = option._serialize_fields()

    # Assert
    assert result == {"version": 6, "options": {}}
Example #2
0
def test_serialize_fields(option: Options):
    # Setup

    # Run
    result = option._serialize_fields()

    # Assert
    assert result == {
        "version": randovania.interface_common.persisted_options._CURRENT_OPTIONS_FILE_VERSION,
        "options": {
            "last_changelog_displayed": str(update_checker.strict_current_version()),
        }
    }
Example #3
0
def test_reset_to_defaults():
    # Create and test they're equal
    blank = Options(MagicMock())
    modified = Options(MagicMock())
    assert blank._serialize_fields() == modified._serialize_fields()

    # Modify and test they're different
    with modified:
        for field in randovania.interface_common.options._SERIALIZER_FOR_FIELD.keys():
            # This cause weirdness in serializing it
            if field != "last_changelog_displayed":
                modified._set_field(field, getattr(modified, field))
    assert blank._serialize_fields() != modified._serialize_fields()

    # Reset and test they're the same
    with modified:
        modified.reset_to_defaults()
    assert blank._serialize_fields() == modified._serialize_fields()