docstr: Test placement range conversion.
          
docstr_tok: ["Test","placement","range","conversion","."]
code: def test_placement_range(self):
      """Test placement range conversion."""
      # Setup 1:
      test_cases = []
      test_cases.append(
          {
              "room_dim": [3, 4, 5],
              "placement": {
                  "x": None,
                  "y": None,
                  "height": None,
                  "min_to_wall": 0,
              },
              "object_radius": 0,
              "expected_range": np.array([[0, 3], [0, 4], [0, 5]]),
          }
      )
  
      test_cases.append(
          {
              "room_dim": [3, 4, 5],
              "placement": {
                  "x": None,
                  "y": None,
                  "height": None,
                  "min_to_wall": 0,
              },
              "object_radius": 0.1,
              "expected_range": np.array(
                  [[0.1, 2.9], [0.1, 3.9], [0.1, 4.9]]
              ),
          }
      )
  
      test_cases.append(
          {
              "room_dim": [3, 4, 5],
              "placement": {
                  "x": None,
                  "y": None,
                  "height": None,
                  "min_to_wall": 0.5,
              },
              "object_radius": 0.1,
              "expected_range": np.array(
                  [[0.6, 2.4], [0.6, 3.4], [0.6, 4.4]]
              ),
          }
      )
  
      test_cases.append(
          {
              "room_dim": [3, 4, 5],
              "placement": {
                  "x": [1, 3],
                  "y": [0.3, 3.0],
                  "height": [1.5, 1.8],
                  "min_to_wall": 0.5,
              },
              "object_radius": 0.1,
              "expected_range": np.array(
                  [[1, 2.4], [0.6, 3.0], [1.5, 1.8]]
              ),
          }
      )
  
      test_cases.append(
          {
              "room_dim": [3, 4, 5],
              "placement": {
                  "x": 2,
                  "y": 3,
                  "height": [1.5, 1.8],
                  "min_to_wall": 0.5,
              },
              "object_radius": 0.1,
              "expected_range": np.array([[2, 2], [3, 3], [1.5, 1.8]]),
          }
      )
  
      for test_case in test_cases:
          placement_range = convert_placement_to_range(
              test_case["placement"],
              test_case["room_dim"],
              test_case["object_radius"],
          )
  
          assert np.all(placement_range == test_case["expected_range"])
  
      with pytest.raises(ValueError):
          # fail because of negative x
          convert_placement_to_range(
              **{
                  "room_dim": [3, 4, 5],
                  "placement": {
                      "x": -1,
                      "y": None,
                      "height": None,
                      "min_to_wall": 0,
                  },
                  "object_radius": 0.1,
              }
          )
  
      with pytest.raises(ValueError):
          # fail because of negative min_to_wall
          convert_placement_to_range(
              **{
                  "room_dim": [3, 4, 5],
                  "placement": {
                      "x": None,
                      "y": None,
                      "height": None,
                      "min_to_wall": -1,
                  },
                  "object_radius": 0.1,
              }
          )
  
      with pytest.raises(ValueError):
          # fail because height range doesn't have exactly two elements
          convert_placement_to_range(
              **{
                  "room_dim": [3, 4, 5],
                  "placement": {
                      "x": None,
                      "y": None,
                      "height": [1],
                      "min_to_wall": 0,
                  },
                  "object_radius": 0.1,
              }
          )
  
      with pytest.raises(ValueError):
          # fail because the room is too small for constraint
          convert_placement_to_range(
              **{
                  "room_dim": [1, 2, 3],
                  "placement": {
                      "x": None,
                      "y": None,
                      "height": None,
                      "min_to_wall": 1,
                  },
                  "object_radius": 0.1,
              }
          )
  
file_path: NeMo/tests/collections/asr/test_asr_data_simulation.py
imports: import os
  import tempfile
  from typing import List, Type, Union
  import numpy
  import pytest
  from numpy.random import default_rng
  from nemo.collections.asr.data.data_simulation import ArrayGeometry, check_angle, convert_placement_to_range, convert_rir_to_multichannel, simulate_room_mix, wrap_to_180
  from nemo.collections.asr.parts.preprocessing.segment import AudioSegment
label_desc: Use image node_id 3 for calling the TestDataSimulationUtils obj's underlying member method code with example usage: obj.test_placement_range() without return types