Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def testSerialize(self):
date = datetime.date(2013, 2, 3)
assert parameter[datetime.date]._p.to_str(date) == "2013-02-03"
assert YearParameter()._p.to_str(date) == "2013"
assert MonthParameter()._p.to_str(date) == "2013-02"
dt = datetime.datetime(2013, 2, 3, 4, 5)
assert parameters.DateHourParameter()._p.to_str(dt) == "2013-02-03T04"
dbnd.output,
dbnd.parameter,
dbnd.data,
databand.task,
tasks.DataSourceTask,
tasks.PipelineTask,
targets.Target,
targets.DataTarget,
dbnd._core.task_build.task_namespace.namespace,
parameters.Parameter,
parameters.DateHourParameter,
parameters.DateMinuteParameter,
parameters.DateSecondParameter,
parameters.DateParameter,
parameters.MonthParameter,
parameters.YearParameter,
parameters.DateIntervalParameter,
parameters.TimeDeltaParameter,
parameters.IntParameter,
parameters.FloatParameter,
parameters.BoolParameter,
]
assert len(expected) > 0
class DateMinuteTask(TTask):
dm = parameters.DateMinuteParameter()
class DateSecondTask(TTask):
ds = parameters.DateSecondParameter()
class MonthTask(TTask):
month = MonthParameter()
class YearTask(TTask):
year = YearParameter()
class TestDateParameter(object):
def test_parse(self):
d = parameter[datetime.date]._p.parse_from_str("2015-04-03")
assert d == datetime.date(2015, 4, 3)
def test_serialize(self):
d = parameter[datetime.date]._p.to_str(datetime.date(2015, 4, 3))
assert d == "2015-04-03"
def test_parse_interface(self):
task = build_task("DateTask", day="2015-04-03")
assert task.day == datetime.date(2015, 4, 3)
def test_parse(self):
year = YearParameter()._p.parse_from_str("2015")
assert year == datetime.date(2015, 1, 1)
def test_serialize(self):
year = YearParameter()._p.to_str(datetime.date(2015, 4, 3))
assert year == "2015"