code: def test_backward_compatible_arguments(self):
      old_schema = parse_schema(
          "any(Tensor self, *, Tensor b, int c) -> Tensor"
      )
      # No-BC: A new schema with less arguments.
      new_schema = parse_schema(
          "any(Tensor self, *, Tensor b) -> Tensor"
      )
      self.assertFalse(
          new_schema.is_backward_compatible_with(old_schema)
      )
      # No-BC: A new schema with more arguments, appended, but no default value.
      new_schema = parse_schema(
          "any(Tensor self, *, Tensor b, int c, int d) -> Tensor"
      )
      self.assertFalse(
          new_schema.is_backward_compatible_with(old_schema)
      )
      # BC: A new schema with more arguments, appended, that have a default value.
      new_schema = parse_schema(
          "any(Tensor self, *, Tensor b, int c, int d=1) -> Tensor"
      )
      self.assertTrue(
          new_schema.is_backward_compatible_with(old_schema)
      )
      # No-BC: A new schema with more arguments, not-appended, that have a default value.
      new_schema = parse_schema(
          "any(Tensor self, int d=1, *, Tensor b, int c) -> Tensor"
      )
      self.assertFalse(
          new_schema.is_backward_compatible_with(old_schema)
      )
      # BC: A new schema where old kwargs becomes positional.
      new_schema = parse_schema(
          "any(Tensor self, Tensor b, *, int c) -> Tensor"
      )
      self.assertTrue(
          new_schema.is_backward_compatible_with(old_schema)
      )
      # BC: (the opposite case) A new schema where an old positional argument becomes kwarg.
      self.assertFalse(
          old_schema.is_backward_compatible_with(new_schema)
      )
      # BC: A new schema where all old kwargs become positional.
      new_schema = parse_schema(
          "any(Tensor self, Tensor b, int c) -> Tensor"
      )
      self.assertTrue(
          new_schema.is_backward_compatible_with(old_schema)
      )
      # BC: (the opposite case) A new schema where all old positional arguments become kwarg.
      self.assertFalse(
          old_schema.is_backward_compatible_with(new_schema)
      )
      # No-BC: A new schema where old kwargs appear in different order.
      new_schema = parse_schema(
          "any(Tensor self, *, int c, Tensor b) -> Tensor"
      )
      self.assertFalse(
          new_schema.is_backward_compatible_with(old_schema)
      )
      # BC: A new schema where argument becomes of type optional.
      new_schema = parse_schema(
          "any(Tensor self, *, Tensor b, int? c) -> Tensor"
      )
      self.assertTrue(
          new_schema.is_backward_compatible_with(old_schema)
      )
      # BC: A new schema where argument gains a default value.
      new_schema = parse_schema(
          "any(Tensor self, *, Tensor b, int c=1) -> Tensor"
      )
      self.assertTrue(
          new_schema.is_backward_compatible_with(old_schema)
      )
      # No-BC: A new schema where argument is "renamed".
      new_schema = parse_schema(
          "any(Tensor self, *, Tensor b, int renamed) -> Tensor"
      )
      self.assertFalse(
          new_schema.is_backward_compatible_with(old_schema)
      )
      # No-BC: A new schema where argument type changes to an incompatible type.
      new_schema = parse_schema(
          "any(Tensor self, *, Tensor b, int[] c) -> Tensor"
      )
      self.assertFalse(
          new_schema.is_backward_compatible_with(old_schema)
      )
  
file_path: pytorch/test/test_function_schema.py
imports: import torch
  from torch.testing._internal.common_utils import TestCase, run_tests
  from torch._C import parse_schema
label_desc: Use image node_id 6 for calling the TestFunctionSchema obj's underlying member method code with example usage: obj.test_backward_compatible_arguments() without return types