Update has() function logic to cache test results

Updated from PR #40