{1..10}
is a bash
feature, it is not defined in POSIX sh
.
It seems that subprocess.check_output("./test.sh", shell=True)
invokes sh
in your second example (Linux) and bash
(or another shell which supports this feature) in the first example (macOS).
See: