replace sphinx 'code' directive with 'doctest'

fixes issue #4100