code: def testAppendInvalidDatetime(self):
      ds = bards.BarDataSeries()
      for i in xrange(10):
          now = datetime.datetime.now() + datetime.timedelta(seconds=i)
          ds.append(
              bar.BasicBar(now, 0, 0, 0, 0, 0, 0, bar.Frequency.SECOND)
          )
          # Adding the same datetime twice should fail
          with self.assertRaises(Exception):
              ds.append(
                  bar.BasicBar(
                      now, 0, 0, 0, 0, 0, 0, bar.Frequency.SECOND
                  )
              )
          # Adding a previous datetime should fail
          with self.assertRaises(Exception):
              ds.append(
                  bar.BasicBar(
                      now - datetime.timedelta(seconds=i),
                      0,
                      0,
                      0,
                      0,
                      0,
                      0,
                      bar.Frequency.SECOND,
                  )
              )
  
imports: import datetime
  from six.moves import xrange
  from .None import common
  from pyalgotrade import dataseries
  from pyalgotrade.dataseries import bards
  from pyalgotrade.dataseries import aligned
  from pyalgotrade import bar
label_desc: Use image node_id 2 for calling the TestBarDataSeries obj's underlying member method code with example usage: obj.testAppendInvalidDatetime() without return types