code: def test_sort_values_validate_ascending_functional(self, ascending):
      df = DataFrame({"D": [23, 7, 21]})
      indexer = df["D"].argsort().values
  
      if not ascending:
          indexer = indexer[::-1]
  
      expected = df.loc[df.index[indexer]]
      result = df.sort_values(by="D", ascending=ascending)
      tm.assert_frame_equal(result, expected)
  
imports: import numpy
  import pytest
  import pandas
  from pandas import Categorical, DataFrame, NaT, Timestamp, date_range
  import pandas._testing
  from pandas.util.version import Version
label_desc: Use image node_id 4 for calling the TestSortValuesLevelAsStr obj's underlying member method code with example usage: obj.test_sort_values_validate_ascending_functional(ascending) without return types