Deduplicated common typehint test code