from tyko.client import TykoClient


def test_client_uses_default_endpoint():
    """Test that the client uses the default API endpoint when no URL is provided."""

    client = TykoClient()
    assert client.api_url == "https://api.tyko-labs.com"


def test_create_experiment():
    """Test creating an experiment with the TykoClient."""

    client = TykoClient()
    experiment = client.create_experiment(name="Test Experiment")

    assert experiment is not None
    assert experiment.name == "Test Experiment"


def test_experiment_representation():
    """Test the string representation of the Experiment class."""

    experiment = TykoClient().create_experiment(name="Sample Experiment")
    repr_str = repr(experiment)

    assert repr_str == "<Experiment name=Sample Experiment>"

def test_create_run():
    """Test creating a run within an experiment."""

    client = TykoClient()
    experiment = client.create_experiment(name="Run Test Experiment")

    # Assuming the Experiment class has a method to start a run
    with experiment.start_run() as run:
        assert run is not None
