Reason for unsetting flags in setUp:
1. frappe.flags.whatever is reset in each request...since it's a werzeug local (ref: https://werkzeug.palletsprojects.com/en/1.0.x/local/)
2. so until it is in the context of current request, it has the same value
3. when you call rename_doc via a request, it's flags are forgotten post that
4. but in a test suite, the whole module's tests run in a single process and the flags aren't (un|re)set
5. which is why frappe.flags.whatever has the same value throughout this module's tests