Improved tests to the detection of AM and PM that it does not depend on the API