Avoid false positives in version tests

Check for the correct exception when testing invalid versions.

[#50972863]
Fix version parsing bug when a version contains '..'

[#50972863]
Merge 50972863- to master

[Completes #50972863]