Hi there,
I have been comparing the output of this script with R's Poisson.test and it seems to me your test commits type 1 error. Even in the example you give -- with one sample, there's no way the p-value should be borderline significant.
Do you know why? I have no idea, but it's just something I noticed.
Take care,
Julia