コード例 #1
0
 def test_source(self):
     """ check tp.source Parsing """
     tp = product.TextProduct(get_file('AFD.txt'))
     self.assertEqual(tp.source, 'KBOX')
コード例 #2
0
def test_product_id():
    """ check valid Parsing """
    tp = product.TextProduct(get_test_file("AFD.txt"))
    assert tp.get_product_id() == "201211270001-KBOX-FXUS61-AFDBOX"
コード例 #3
0
def test_FFA():
    """ check FFA Parsing """
    tp = product.TextProduct(get_test_file("FFA.txt"))
    assert tp.segments[0].get_hvtec_nwsli() == "NWYI3"
コード例 #4
0
def test_wmo():
    """ check tp.wmo Parsing """
    tp = product.TextProduct(get_test_file("AFD.txt"))
    assert tp.wmo == "FXUS61"
コード例 #5
0
def test_signature():
    """ check svs_search """
    tp = product.TextProduct(get_test_file("TOR.txt"))
    assert tp.get_signature() == "CBD"
コード例 #6
0
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
コード例 #7
0
def test_afos():
    """ check AFOS PIL Parsing """
    tp = product.TextProduct(get_test_file("AFD.txt"))
    assert tp.afos == "AFDBOX"
コード例 #8
0
 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)
コード例 #9
0
 def test_FFA(self):
     """ check FFA Parsing """
     tp = product.TextProduct(get_file('FFA.txt'))
     self.assertEqual(tp.segments[0].get_hvtec_nwsli(), "NWYI3")
コード例 #10
0
 def test_spanishMWW(self):
     """ check spanish MWW does not break things """
     tp = product.TextProduct(get_file('MWWspanish.txt'))
     self.assertEqual(tp.z, None)
コード例 #11
0
 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")
コード例 #12
0
 def test_signature(self):
     """ check svs_search """
     tp = product.TextProduct(get_file('TOR.txt'))
     self.assertEqual(tp.get_signature(), "CBD")
コード例 #13
0
 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)
コード例 #14
0
 def test_wmo(self):
     """ check tp.wmo Parsing """
     tp = product.TextProduct(get_file('AFD.txt'))
     self.assertEqual(tp.wmo, 'FXUS61')
コード例 #15
0
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
コード例 #16
0
 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")
コード例 #17
0
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
コード例 #18
0
 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)
コード例 #19
0
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
コード例 #20
0
 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())
コード例 #21
0
def test_source():
    """ check tp.source Parsing """
    tp = product.TextProduct(get_test_file("AFD.txt"))
    assert tp.source == "KBOX"
コード例 #22
0
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()
コード例 #23
0
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
コード例 #24
0
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
コード例 #25
0
def test_spanishMWW():
    """ check spanish MWW does not break things """
    tp = product.TextProduct(get_test_file("MWWspanish.txt"))
    assert tp.z is None
コード例 #26
0
def test_empty():
    """ see what happens when we send a blank string """
    with pytest.raises(TextProductException):
        product.TextProduct("")
コード例 #27
0
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
コード例 #28
0
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
コード例 #29
0
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
コード例 #30
0
 def test_afos(self):
     """ check AFOS PIL Parsing """
     tp = product.TextProduct(get_file('AFD.txt'))
     self.assertEqual(tp.afos, 'AFDBOX')