Extracted testcases from common.py.

make pytest works again.