Python tests: metar output

This commit is contained in:
Shahram Najm 2019-06-12 15:47:22 +01:00
parent 2133aa19dd
commit dc40707359
2 changed files with 14 additions and 7 deletions

View File

@ -28,6 +28,7 @@ def print_keys(msg_id):
'elevation', 'temperature', 'dewPointTemperature', 'qnh']
for key in keys:
try:
if codes_is_defined(msg_id, key):
print(' %s: %s' % (key, codes_get(msg_id, key)))
except CodesInternalError as err:
print('Error with key="%s" : %s' % (key, err.msg))

View File

@ -16,14 +16,20 @@ label="metar_get_keys_test_p"
#Define tmp file
fTmp=${label}.tmp.txt
rm -f $fTmp | true
rm -f $fTmp
REDIRECT=/dev/null
#Write the key values into a file
# Write the key values into a file
$PYTHON $examples_src/metar_get_keys.py 2> $REDIRECT > $fTmp
#TODO: check the results
# Check the results
grep -q "message: 157" $fTmp
count=`grep -c latitude $fTmp`
[ $count -eq 126 ]
count=`grep -c dewPointTemperature $fTmp`
[ $count -eq 133 ]
#Clean up
rm -f $fTmp | true
# Clean up
rm -f $fTmp