示例#1
0
文件: test_cf6.py 项目: xoxo143/pyIEM
def test_200421_nan(dbcursor):
    """Test database insert that was failing with NaN values."""
    prod = parser(get_test_file("CF6/CF6MKK.txt"))
    prod.sql(dbcursor)

    dbcursor.execute(
        "SELECT wxcodes from cf6_data_2020 where station = 'PMKK' and "
        "valid = '2020-04-18'"
    )
    assert dbcursor.fetchone()[0] == "X"
示例#2
0
文件: test_cf6.py 项目: xoxo143/pyIEM
def test_trace(dbcursor):
    """Ensure that our decoder is properly dealing with trace values."""
    prod = parser(get_test_file("CF6/CF6SEA.txt"))
    assert prod.df.index.values[0] == datetime.date(2020, 2, 1)
    assert prod.df.iloc[15]["wtr"] == TRACE_VALUE
    prod.sql(dbcursor)

    dbcursor.execute(
        "SELECT possible_sunshine from cf6_data_2020 where station = 'KSEA' "
        "and valid = '2020-02-01'"
    )
    assert dbcursor.fetchone()[0] is None
示例#3
0
文件: test_cf6.py 项目: xoxo143/pyIEM
def test_nodata(dbcursor):
    """Test when there is no data in the product."""
    prod = parser(get_test_file("CF6/CF6DSM_empty.txt"))
    prod.sql(dbcursor)
    assert prod.df.empty
示例#4
0
文件: test_cf6.py 项目: xoxo143/pyIEM
def test_missing_header():
    """Test exception when there is a missing header."""
    with pytest.raises(ValueError):
        parser(get_test_file("CF6/CF6DSM_bad.txt"))
示例#5
0
文件: test_cf6.py 项目: xoxo143/pyIEM
def test_basic(dbcursor):
    """Test CF6 Parsing."""
    prod = parser(get_test_file("CF6/CF6DSM.txt"))
    assert prod.df.iloc[0]["max"] == 42
    prod.sql(dbcursor)
示例#6
0
文件: test_cf6.py 项目: xoxo143/pyIEM
def test_200224_time():
    """Test failure found with timestamp parsing."""
    prod = parser(get_test_file("CF6/CF6WYS.txt"))
    assert prod.df.iloc[0]["max"] == 32
示例#7
0
文件: test_cf6.py 项目: xoxo143/pyIEM
def test_200302_regex_error():
    """Test failure found with some regex failure."""
    prod = parser(get_test_file("CF6/CF6GRR.txt"))
    assert prod.df.iloc[0]["max"] == 51
示例#8
0
文件: cf6_parser.py 项目: xlia/pyWWA
def processor(txn, text):
    """ Protect the realprocessor """
    prod = parser(text)
    prod.sql(txn)