text: import os
  import unittest
  from unittest import mock
  from checkov.common.bridgecrew.platform_integration import BcPlatformIntegration
  from checkov.common.util.docs_generator import get_compare_key
  
  
  class TestOutputSorting(unittest.TestCase):
  
      def test_id_sorting_for_ckv_pattern(self):
          # keep all other things the same so sorting is based on the id
          check_ids = [
              ['CKV_AWS_1', '', '', '', ''],
              ['CKV_K8S_11', '', '', '', ''],
              ['CKV_K8S_15', '', '', '', ''],
              ['CKV_K8S_9', '', '', '', ''],
              ['CKV_K8S_2', '', '', '', ''],
              ['CKV_AZURE_11', '', '', '', ''],
              ['CKV_AZURE_32', '', '', '', ''],
              ['CKV_GIT_1', '', '', '', ''],
              ['CKV_AZURE_10', '', '', '', ''],
              ['CKV_AZURE_22', '', '', '', ''],
              ['CKV_K8S_20', '', '', '', ''],
              ['CKV_GCP_1', '', '', '', ''],
              ['CKV_K8S_1', '', '', '', ''],
              ['CKV_GCP_10', '', '', '', ''],
              ['CKV_AZURE_12', '', '', '', ''],
              ['CKV_K8S_10', '', '', '', ''],
              ['CKV_AWS_20', '', '', '', ''],
          ]
          sorted_check_ids = sorted(check_ids, key=get_compare_key)
          self.assertEqual(sorted_check_ids, [
              ['CKV_AWS_1', '', '', '', ''],
              ['CKV_AWS_20', '', '', '', ''],
              ['CKV_AZURE_10', '', '', '', ''],
              ['CKV_AZURE_11', '', '', '', ''],
              ['CKV_AZURE_12', '', '', '', ''],
              ['CKV_AZURE_22', '', '', '', ''],
              ['CKV_AZURE_32', '', '', '', ''],
              ['CKV_GCP_1', '', '', '', ''],
              ['CKV_GCP_10', '', '', '', ''],
              ['CKV_GIT_1', '', '', '', ''],
              ['CKV_K8S_1', '', '', '', ''],
              ['CKV_K8S_2', '', '', '', ''],
              ['CKV_K8S_9', '', '', '', ''],
              ['CKV_K8S_10', '', '', '', ''],
              ['CKV_K8S_11', '', '', '', ''],
              ['CKV_K8S_15', '', '', '', ''],
              ['CKV_K8S_20', '', '', '', ''],
          ])
  
      def test_id_sorting_for_other_patterns(self):
          # keep all other things the same so sorting is based on the id
          check_ids = [
              ['A_03_C_02', '', '', '', ''],
              ['A_03_C_1', '', '', '', ''],
              ['A_01', '', '', '', ''],
              ['A_2', '', '', '', ''],
              ['A_03_C_2', '', '', '', ''],
              ['A_1_B', '', '', '', ''],
              ['A_1_A', '', '', '', ''],
              ['A_02_A', '', '', '', ''],
              ['B_2_0', '', '', '', ''],
              ['B_1_1', '', '', '', ''],
              ['C_0_1', '', '', '', ''],
              ['B_1_2', '', '', '', ''],
              ['A_1', '', '', '', ''],
              ['C_1', '', '', '', ''],
              ['C_2', '', '', '', ''],
              ['A_03_B', '', '', '', ''],
              ['B_1', '', '', '', ''],
          ]
          sorted_check_ids = sorted(check_ids, key=get_compare_key)
          self.assertEqual(sorted_check_ids, [
              ['A_1', '', '', '', ''],
              ['A_1_A', '', '', '', ''],
              ['A_1_B', '', '', '', ''],
              ['A_01', '', '', '', ''],
              ['A_2', '', '', '', ''],
              ['A_02_A', '', '', '', ''],
              ['A_03_B', '', '', '', ''],
              ['A_03_C_1', '', '', '', ''],
              ['A_03_C_2', '', '', '', ''],
              ['A_03_C_02', '', '', '', ''],
              ['B_1', '', '', '', ''],
              ['B_1_1', '', '', '', ''],
              ['B_1_2', '', '', '', ''],
              ['B_2_0', '', '', '', ''],
              ['C_0_1', '', '', '', ''],
              ['C_1', '', '', '', ''],
              ['C_2', '', '', '', ''],
          ])
  
      def test_id_sorting_for_arbitrary_string(self):
          # keep all other things the same so sorting is based on the id
          check_ids = [
              ['Xa1246', '', '', '', ''],
              ['X124', '', '', '', ''],
              ['so_a2_3', '', '', '', ''],
              ['so_aa2_3', '', '', '', ''],
              ['aDa(8)', '', '', '', ''],
              ['X1246', '', '', '', ''],
              ['X123', '', '', '', ''],
              ['1a', '', '', '', ''],
              ['Xa12a1', '', '', '', ''],
              ['Ada', '', '', '', ''],
              ['so_b1', '', '', '', ''],
              ['2a', '', '', '', ''],
              ['X1245', '', '', '', ''],
              ['Xa12', '', '', '', ''],
              ['aDa(9)', '', '', '', ''],
              ['2b', '', '', '', ''],
              ['aDa(7)asd', '', '', '', ''],
              ['Xa2', '', '', '', ''],
              ['Xa12ab', '', '', '', ''],
          ]
          sorted_check_ids = sorted(check_ids, key=get_compare_key)
          self.assertEqual(sorted_check_ids, [
              ['1a', '', '', '', ''],
              ['2a', '', '', '', ''],
              ['2b', '', '', '', ''],
              ['Ada', '', '', '', ''],
              ['X123', '', '', '', ''],
              ['X124', '', '', '', ''],
              ['X1245', '', '', '', ''],
              ['X1246', '', '', '', ''],
              ['Xa2', '', '', '', ''],
              ['Xa12', '', '', '', ''],
              ['Xa12a1', '', '', '', ''],
              ['Xa12ab', '', '', '', ''],
              ['Xa1246', '', '', '', ''],
              ['aDa(7)asd', '', '', '', ''],
              ['aDa(8)', '', '', '', ''],
              ['aDa(9)', '', '', '', ''],
              ['so_a2_3', '', '', '', ''],
              ['so_aa2_3', '', '', '', ''],
              ['so_b1', '', '', '', ''],
          ])
  
      def test_id_sorting_leading_zeros(self):
          # keep all other things the same so sorting is based on the id
          check_ids = [
              ['0542', '', '', '', ''],
              ['002', '', '', '', ''],
              ['00542', '', '', '', ''],
              ['001_03', '', '', '', ''],
              ['2', '', '', '', ''],
              ['01', '', '', '', ''],
              ['542', '', '', '', ''],
              ['4', '', '', '', ''],
              ['03', '', '', '', ''],
              ['1', '', '', '', ''],
              ['001', '', '', '', ''],
              ['001_003', '', '', '', ''],
              ['001_0002', '', '', '', ''],
              ['0002', '', '', '', ''],
          ]
          sorted_check_ids = sorted(check_ids, key=get_compare_key)
          self.assertEqual(sorted_check_ids, [
              ['1', '', '', '', ''],
              ['01', '', '', '', ''],
              ['001', '', '', '', ''],
              ['001_0002', '', '', '', ''],
              ['001_03', '', '', '', ''],
              ['001_003', '', '', '', ''],
              ['2', '', '', '', ''],
              ['002', '', '', '', ''],
              ['0002', '', '', '', ''],
              ['03', '', '', '', ''],
              ['4', '', '', '', ''],
              ['542', '', '', '', ''],
              ['0542', '', '', '', ''],
              ['00542', '', '', '', ''],
          ])
  
  
  if __name__ == '__main__':
      unittest.main()
  