The following code results in h_0 being rejected even though the sample was carefully chosen to match the distribution:
using HypothesisTests, Distributions
n = 50
x = 0.5 .^ (1:n)
d = DiscreteNonParametric(1:n, x ./ sum(x))
sample = vcat(ones(Int64,16), 2*ones(Int64,8), 3*ones(Int64,4), 4,4,5)
display(ExactOneSampleKSTest(sample, d))
In https://discourse.julialang.org/t/komolgorov-smirnov-test/89990/6 a person also found a big difference between results obtained with ApproximateTwoSampleKSTest and those obtained with scipy stats.