import pytest
from runtime.learning.preferences import Preferences

@pytest.fixture
def prefs(tmp_path):
    return Preferences(tmp_path)

def test_save_and_get(prefs):
    prefs.save("test_key", "test_value")
    assert prefs.get("test_key") == "test_value"
    assert prefs.get("missing_key", "default") == "default"

def test_reset(prefs):
    prefs.save("k1", "v1")
    prefs.save("k2", "v2")
    
    prefs.reset("k1")
    assert prefs.get("k1") is None
    assert prefs.get("k2") == "v2"
    
    prefs.reset()
    assert prefs.get("k2") is None
