code: def test_automatic_upcasting():
      assert type(m.return_class_1()).__name__ == "DerivedClass1"
      assert type(m.return_class_2()).__name__ == "DerivedClass2"
      assert type(m.return_none()).__name__ == "NoneType"
      # Repeat these a few times in a random order to ensure no invalid caching is applied
      assert type(m.return_class_n(1)).__name__ == "DerivedClass1"
      assert type(m.return_class_n(2)).__name__ == "DerivedClass2"
      assert type(m.return_class_n(0)).__name__ == "BaseClass"
      assert type(m.return_class_n(2)).__name__ == "DerivedClass2"
      assert type(m.return_class_n(2)).__name__ == "DerivedClass2"
      assert type(m.return_class_n(0)).__name__ == "BaseClass"
      assert type(m.return_class_n(1)).__name__ == "DerivedClass1"
  
imports: import pytest
  import env
  from pybind11_tests import ConstructorStats, UserType
  from pybind11_tests import class_
label_desc: Use image node_id 14 for calling a global function with example usage: test_automatic_upcasting() without return types