def test_uses_step_metric(mock_convert):
    """Test that the LoggerConnector uses explicitly provided step metric to log metrics."""

    trainer = MagicMock(spec=Trainer)
    trainer.loggers = [logger := MagicMock(spec=Logger)]
    connector = _LoggerConnector(trainer)
    mock_convert.return_value.pop.return_value = step = 42.0

    metrics = {"some_metric": 123}
    connector.log_metrics(logged_metrics := {**metrics, "step": step})

    assert connector._logged_metrics == logged_metrics
    mock_convert.assert_called_once_with(logged_metrics)
    logger.log_metrics.assert_called_once_with(metrics=mock_convert.return_value, step=int(step))
    logger.save.assert_called_once_with()
Test that the LoggerConnector uses explicitly provided step metric to log metrics.
tests/tests_pytorch/trainer/connectors/test_logger_connector.py