コード例 #1
0
import parsedates as p
import Parser_ts  as dt_parse
import datetime

from numpy.testing import *

p.set_callback(dt_parse.DateTimeFromString)

# All test numbers were pulled from either the SciKits TimeSeries Module (example):
#    >>> print t.Date("Minute", "1970-01-10").value
#    12961
# or the Unix date command (example):
#    $ date -d "1000-01-01 00:00:01 GMT" +%s
#    -30610223999

class TestCreation():
# Test each frequencies' creation and proper value

    ########################################################################
    ## Frequency Tests
    ########################################################################

    # YEAR
    def test_pre_epoch_year(self):
        "Test creation of years pre epoch."

        dstring = '1969'
        assert_equal(p.date_to_long(dstring, 'Y'), -1)

        dstring = '1940'
        assert_equal(p.date_to_long(dstring, 'Y'), -30)
コード例 #2
0
ファイル: test.py プロジェクト: martyfuhry/npy_datetime
import parsedates

def parse(args):
 print "Arguments are: ", args

def add_ints(a,b):
 a = int(a)
 b = int(b)
 return a + b

parsedates.set_callback(parse)
parsedates.parse_date("one")