code: def test_n_rectangles(self, device, batch, N, fill):
      points_list = []
      h, w = 20, 20
      for b in range(batch):
          points_list.append([])
          for n in range(N):
              points_list[b].append([])
              points_list[b][n].append(
                  int(torch.randint(0, w - 1, (1,)))
              )
              points_list[b][n].append(
                  int(torch.randint(0, h - 1, (1,)))
              )
              points_list[b][n].append(
                  int(torch.randint(points_list[b][n][-2] + 1, w, (1,)))
              )
              points_list[b][n].append(
                  int(torch.randint(points_list[b][n][-2] + 1, h, (1,)))
              )
  
      points = torch.tensor(points_list, device=device)
  
      random_background = torch.rand(batch, 3, h, w, device=device)
      random_w_rectangle = random_background.clone()
  
      draw_rectangle(
          random_w_rectangle,
          points,
          color=torch.tensor([1.0, 1.0, 1.0]),
          fill=fill,
      )
  
      for b in range(batch):
          for n in range(N):
              if fill:
                  assert (
                      random_w_rectangle[
                          b,
                          :,
                          points_list[b][n][1] : points_list[b][n][3]
                          + 1,
                          points_list[b][n][0] : points_list[b][n][2]
                          + 1,
                      ].sum()
                      == (
                          points_list[b][n][3]
                          - points_list[b][n][1]
                          + 1
                      )
                      * (
                          points_list[b][n][2]
                          - points_list[b][n][0]
                          + 1
                      )
                      * 3
                  )
              else:
                  assert (
                      random_w_rectangle[
                          b,
                          :,
                          points_list[b][n][1] : points_list[b][n][3]
                          + 1,
                          points_list[b][n][0],
                      ].sum()
                      == (
                          points_list[b][n][3]
                          - points_list[b][n][1]
                          + 1
                      )
                      * 3
                  )
                  assert (
                      random_w_rectangle[
                          b,
                          :,
                          points_list[b][n][1] : points_list[b][n][3]
                          + 1,
                          points_list[b][n][2],
                      ].sum()
                      == (
                          points_list[b][n][3]
                          - points_list[b][n][1]
                          + 1
                      )
                      * 3
                  )
                  assert (
                      random_w_rectangle[
                          b,
                          :,
                          points_list[b][n][1],
                          points_list[b][n][0] : points_list[b][n][2]
                          + 1,
                      ].sum()
                      == (
                          points_list[b][n][2]
                          - points_list[b][n][0]
                          + 1
                      )
                      * 3
                  )
                  assert (
                      random_w_rectangle[
                          b,
                          :,
                          points_list[b][n][1],
                          points_list[b][n][0] : points_list[b][n][2]
                          + 1,
                      ].sum()
                      == (
                          points_list[b][n][2]
                          - points_list[b][n][0]
                          + 1
                      )
                      * 3
                  )
  
imports: import math
  import pytest
  import torch
  from kornia.testing import assert_close
  from kornia.utils import create_meshgrid, draw_convex_polygon, draw_rectangle
  from kornia.utils.draw import draw_line, draw_point2d
label_desc: Use image node_id 3 for calling the TestDrawRectangle obj's underlying member method code with example usage: obj.test_n_rectangles(device, batch, N, fill) without return types