class_docstr: Tests that data transformers inheriting from both `FittableDataTransformer` and
  `InvertibleDataTransformer` classes behave correctly when `global_fit` attribute
  is `False`.
class_docstr_tok: ["Tests","that","data","transformers","inheriting","from","both","`","FittableDataTransformer","`","and","`","InvertibleDataTransformer","`","classes","behave","correctly","when","`","global_fit","`","attribute","is","`","False","`","."]
docstr: Tests that automatic component masking is correctly implemented,
  and that manual component masking is also handled correctly
  through `kwargs` + `apply_component_mask`/`unapply_component_mask`
  methods.
docstr_tok: ["Tests","that","automatic","component","masking","is","correctly","implemented",",","and","that","manual","component","masking","is","also","handled","correctly","through","`","kwargs","`","+","`","apply_component_mask","`","\/","`","unapply_component_mask","`","methods","."]
code: def test_input_transformed_masking(self):
      """
      Tests that automatic component masking is correctly implemented,
      and that manual component masking is also handled correctly
      through `kwargs` + `apply_component_mask`/`unapply_component_mask`
      methods.
      """
      test_input = TimeSeries.from_values(np.ones((4, 3, 5)))
      mask = np.array([True, False, True])
      # Second component should be untransformed:
      scale = 2
      translation = 10
      expected = np.stack(
          [12 * np.ones((4, 5)), np.ones((4, 5)), 12 * np.ones((4, 5))],
          axis=1,
      )
      expected = TimeSeries.from_values(expected)
  
      # Automatically apply component mask:
      mock = self.DataTransformerMock(
          scale=scale, translation=translation, mask_components=True
      )
      transformed = mock.fit_transform(test_input, component_mask=mask)
      assert transformed == expected
      # Should get input back:
      inv = mock.inverse_transform(transformed, component_mask=mask)
      assert inv == test_input
  
      # Manually apply component mask:
      mock = self.DataTransformerMock(
          scale=2, translation=10, mask_components=False
      )
      transformed = mock.fit_transform(test_input, component_mask=mask)
      assert transformed == expected
      # Should get input back:
      inv = mock.inverse_transform(transformed, component_mask=mask)
      assert inv == test_input
  
file_path: darts/darts/tests/dataprocessing/transformers/test_invertible_fittable_data_transformer.py
imports: from typing import Any, Mapping, Sequence, Union
  import numpy
  from darts import TimeSeries
  from darts.dataprocessing.transformers.fittable_data_transformer import FittableDataTransformer
  from darts.dataprocessing.transformers.invertible_data_transformer import InvertibleDataTransformer
  from darts.utils.timeseries_generation import constant_timeseries
label_desc: Use image node_id 4 for calling the TestLocalFittableInvertibleDataTransformer obj's underlying member method code with example usage: obj.test_input_transformed_masking() without return types