def test_source(self): """ check tp.source Parsing """ tp = product.TextProduct(get_file('AFD.txt')) self.assertEqual(tp.source, 'KBOX')
def test_product_id(): """ check valid Parsing """ tp = product.TextProduct(get_test_file("AFD.txt")) assert tp.get_product_id() == "201211270001-KBOX-FXUS61-AFDBOX"
def test_FFA(): """ check FFA Parsing """ tp = product.TextProduct(get_test_file("FFA.txt")) assert tp.segments[0].get_hvtec_nwsli() == "NWYI3"
def test_wmo(): """ check tp.wmo Parsing """ tp = product.TextProduct(get_test_file("AFD.txt")) assert tp.wmo == "FXUS61"
def test_signature(): """ check svs_search """ tp = product.TextProduct(get_test_file("TOR.txt")) assert tp.get_signature() == "CBD"
def test_000000_ugctime(): """ When there is 000000 as UGC expiration time """ tp = product.TextProduct(get_test_file("RECFGZ.txt")) assert tp.segments[0].ugcexpire is None
def test_afos(): """ check AFOS PIL Parsing """ tp = product.TextProduct(get_test_file("AFD.txt")) assert tp.afos == "AFDBOX"
def test_valid(self): """ check valid Parsing """ tp = product.TextProduct(get_file('AFD.txt')) ts = datetime.datetime(2012, 11, 27, 0, 1) ts = ts.replace(tzinfo=pytz.timezone("UTC")) self.assertEqual(tp.valid, ts)
def test_FFA(self): """ check FFA Parsing """ tp = product.TextProduct(get_file('FFA.txt')) self.assertEqual(tp.segments[0].get_hvtec_nwsli(), "NWYI3")
def test_spanishMWW(self): """ check spanish MWW does not break things """ tp = product.TextProduct(get_file('MWWspanish.txt')) self.assertEqual(tp.z, None)
def test_product_id(self): """ check valid Parsing """ tp = product.TextProduct(get_file('AFD.txt')) self.assertEqual(tp.get_product_id(), "201211270001-KBOX-FXUS61-AFDBOX")
def test_signature(self): """ check svs_search """ tp = product.TextProduct(get_file('TOR.txt')) self.assertEqual(tp.get_signature(), "CBD")
def test_notml(self): """ check TOR without TIME...MOT...LOC """ tp = product.TextProduct(get_file('TOR.txt')) self.assertEqual(tp.segments[0].tml_dir, None)
def test_wmo(self): """ check tp.wmo Parsing """ tp = product.TextProduct(get_file('AFD.txt')) self.assertEqual(tp.wmo, 'FXUS61')
def test_no_ugc(): """ Product that does not have UGC encoding """ data = get_test_file("CCFMOB.txt") tp = product.TextProduct(data) assert not tp.segments[0].ugcs
def test_tags(self): """ Test tags parsing """ tp = product.TextProduct(get_file('TORtag.txt')) self.assertEqual(tp.segments[0].tornadotag, "OBSERVED") self.assertEqual(tp.segments[0].tornadodamagetag, "SIGNIFICANT")
def test_ugc_invalid_coding(): """ UGC code regression """ data = get_test_file("FLW_badugc.txt") tp = product.TextProduct(data) # self.assertRaises(ugc.UGCParseException, product.TextProduct, data ) assert not tp.segments[0].ugcs
def test_longitude_processing(self): ''' Make sure that parsed longitude values are negative! ''' tp = product.TextProduct(get_file('SVRBMX.txt')) self.assertAlmostEqual(tp.segments[0].sbw.exterior.xy[0][0], -88.39, 2)
def test_stray_space_in_ugc(): """ When there are stray spaces in the UGC! """ tp = product.TextProduct(get_test_file("RVDCTP.txt")) assert len(tp.segments[0].ugcs) == 28
def test_140710_wmoheader_fail(self): """ Make sure COR in WMO header does not trip us up""" tp = product.TextProduct(get_file('MANANN.txt')) self.assertEqual(tp.afos, 'MANANN') self.assertTrue(tp.is_correction())
def test_source(): """ check tp.source Parsing """ tp = product.TextProduct(get_test_file("AFD.txt")) assert tp.source == "KBOX"
def test_140710_wmoheader_fail(): """ Make sure COR in WMO header does not trip us up""" tp = product.TextProduct(get_test_file("MANANN.txt")) assert tp.afos == "MANANN" assert tp.is_correction()
def test_notml(): """ check TOR without TIME...MOT...LOC """ tp = product.TextProduct(get_test_file("TOR.txt")) assert tp.segments[0].tml_dir is None
def test_nomnd_with_timestamp(): """ Make sure we process timestamps correctly when there is no MND""" utcnow = utc(2013, 12, 31, 18) tp = product.TextProduct(get_test_file("MAVWC0.txt"), utcnow=utcnow) ts = utc(2014, 1, 1) assert tp.valid == ts
def test_spanishMWW(): """ check spanish MWW does not break things """ tp = product.TextProduct(get_test_file("MWWspanish.txt")) assert tp.z is None
def test_empty(): """ see what happens when we send a blank string """ with pytest.raises(TextProductException): product.TextProduct("")
def test_valid(): """ check valid Parsing """ tp = product.TextProduct(get_test_file("AFD.txt")) ts = utc(2012, 11, 27, 0, 1) assert tp.valid == ts
def test_invalid_mnd_date(): """ Check parsing of timestamp """ answer = utc(2013, 1, 3, 6, 16) tp = product.TextProduct(get_test_file("CLI/CLINYC.txt")) assert tp.valid == answer
def test_valid_nomnd(): """ check valid (no Mass News) Parsing """ utcnow = utc(2012, 11, 27) tp = product.TextProduct(get_test_file("AFD_noMND.txt"), utcnow=utcnow) ts = utc(2012, 11, 27, 0, 1) assert tp.valid == ts
def test_afos(self): """ check AFOS PIL Parsing """ tp = product.TextProduct(get_file('AFD.txt')) self.assertEqual(tp.afos, 'AFDBOX')