'Test that tasks properly take start/end dates from DAGs'

def test_set_task_dates(self):

    dag = DAG(u'dag', start_date=DEFAULT_DATE, end_date=(DEFAULT_DATE + datetime.timedelta(days=10)))
    op1 = DummyOperator(task_id=u'op_1', owner=u'test')
    self.assertTrue(((op1.start_date is None) and (op1.end_date is None)))
    dag.add_task(op1)
    self.assertTrue(((op1.start_date == dag.start_date) and (op1.end_date == dag.end_date)))
    op2 = DummyOperator(task_id=u'op_2', owner=u'test', start_date=(DEFAULT_DATE - datetime.timedelta(days=1)), end_date=(DEFAULT_DATE + datetime.timedelta(days=11)))
    dag.add_task(op2)
    self.assertTrue(((op2.start_date == dag.start_date) and (op2.end_date == dag.end_date)))
    op3 = DummyOperator(task_id=u'op_3', owner=u'test', start_date=(DEFAULT_DATE + datetime.timedelta(days=1)), end_date=(DEFAULT_DATE + datetime.timedelta(days=9)))
    dag.add_task(op3)
    self.assertTrue((op3.start_date == (DEFAULT_DATE + datetime.timedelta(days=1))))
    self.assertTrue((op3.end_date == (DEFAULT_DATE + datetime.timedelta(days=9))))
