I have been using TensorFunctionSpace to calculate stress values. But according to this post, I realized that it is discontinued from the dolfinx.fem module.
My question is, if I only changed the first line to: Function_space_for_sigma = FunctionSpace(mesh, ("DG", 1))
is the output exactly the same as it was in the case of: Function_space_for_sigma = TensorFunctionSpace(mesh, ("DG", 1))
If you read the first post you linked you will see it points you to the GitHub pull request that updates the process for both Vector and Tensor spaces. Reviewing Pull #2766 you can see that under changes to “python/test/unit/fem/test_assembler.py” the replacements for those spaces are provided. Therefore the answer is no, you need to modify the FunctionSpace appropriately as given in that example.