docstr: Tests sector exposure mapping and rollup.
docstr_tok: ["Tests","sector","exposure","mapping","and","rollup","."]
code: def test_sector_exposure(
      self,
      positions,
      mapping,
      expected_sector_exposure,
      warning_expected,
  ):
      """
      Tests sector exposure mapping and rollup.
  
      """
      with warnings.catch_warnings(record=True) as w:
          result_sector_exposure = get_sector_exposures(
              positions, mapping
          )
  
          assert_frame_equal(
              result_sector_exposure, expected_sector_exposure
          )
          if warning_expected:
              self.assertEqual(len(w), 1)
          else:
              self.assertEqual(len(w), 0)
  
file_path: pyfolio/pyfolio/tests/test_pos.py
imports: from unittest import TestCase
  from nose_parameterized import parameterized
  from collections import OrderedDict
  import os
  import gzip
  from pandas import Series, DataFrame, date_range, Timestamp, read_csv
  from pandas.util.testing import assert_frame_equal
  from numpy import arange, zeros_like, nan
  import warnings
  from pyfolio.utils import to_utc, to_series, check_intraday, detect_intraday, estimate_intraday
  from pyfolio.pos import get_percent_alloc, extract_pos, get_sector_exposures, get_max_median_position_concentration
label_desc: Use image node_id 3 for calling the PositionsTestCase obj's underlying member method code with example usage: obj.test_sector_exposure(positions, mapping, expected_sector_exposure, warning_expected) without return types