Add test case for infinite recursion issue when pickling