Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_parse(self):
ds = parameters.DateSecondParameter()._p.parse_from_str("2013-02-01T184227")
assert ds == datetime.datetime(2013, 2, 1, 18, 42, 27, tzinfo=utc)
def test_serialize(self):
ds = parameters.DateSecondParameter()._p.to_str(
datetime.datetime(2013, 2, 1, 18, 42, 27)
)
assert ds == "2013-02-01T184227"
class DateTask(TTask):
day = parameter[datetime.date]
class DateHourTask(TTask):
dh = parameters.DateHourParameter()
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):
expected = [
dbnd.Config,
dbnd.Task,
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