code: def test_choose_param_value_preserves_nones():
      # preserves None found for main param and still removes aliases
      params = lgb.basic._choose_param_value(
          main_param_name="num_threads",
          params={
              "num_threads": None,
              "n_jobs": 4,
              "objective": "regression",
          },
          default_value=2,
      )
      assert params == {"num_threads": None, "objective": "regression"}
  
      # correctly chooses value when only an alias is provided
      params = lgb.basic._choose_param_value(
          main_param_name="num_threads",
          params={"n_jobs": None, "objective": "regression"},
          default_value=2,
      )
      assert params == {"num_threads": None, "objective": "regression"}
  
      # adds None if that's given as the default and param not found
      params = lgb.basic._choose_param_value(
          main_param_name="min_data_in_leaf",
          params={"objective": "regression"},
          default_value=None,
      )
      assert params == {
          "objective": "regression",
          "min_data_in_leaf": None,
      }
  
imports: import filecmp
  import numbers
  import re
  from copy import deepcopy
  from os import getenv
  from pathlib import Path
  import numpy
  import pytest
  from scipy import sparse
  from sklearn.datasets import dump_svmlight_file, load_svmlight_file
  from sklearn.model_selection import train_test_split
  import lightgbm
  from lightgbm.compat import PANDAS_INSTALLED, pd_DataFrame, pd_Series
  from .utils import dummy_obj, load_breast_cancer, mse_obj, np_assert_array_equal
label_desc: Use image node_id 20 for calling a global function with example usage: test_choose_param_value_preserves_nones() without return types