def test_header_success_missing_release_time(): header = "#GRM00016622 2018 01 01 00 9999 2 ncdc-gts 405272 229714" expected = Sounding( station="GRM00016622", obstime=datetime(2018, 1, 1, 0, 0, tzinfo=timezone.utc), reltime=None, nlevels=2, datasource_p=P_SRC.ncdc_gts, datasource_np=None, location=Location(40.5272, 22.9714) ) sounding = IgraParser.parse_header(header) assert sounding == expected
def test_header_bad_length(): header = "#GRM00016622 2018 01 01 00 2333 2 ncdc-gts 405272 229714P" with pytest.raises(SoundingException, match=r".*length.*"): IgraParser.parse_header(header)
def test_header_bad_headrec(): header = "?GRM00016622 2018 01 01 00 2333 2 ncdc-gts 405272 229714" with pytest.raises(SoundingException, match=r".*character.*"): IgraParser.parse_header(header)