Can you simplify testArray and testRangesArray by replacing positive with a function, and factoring out two helper functions, one which assert_throws and one which assert_unreacheds?