Fix doc and associated test about get_scalar_constant_value

fixes gh-1300
Added an assert in an example to show people how to test that.
pep8
Fix c code in example and add c_code_cache_version.
Add code to test the example
Added comment following code review.
Merge pull request #1361 from nouiz/get_scalar_constant_value

Get scalar constant value