code: def testStraightLine(self):
      seqDS = dataseries.SequenceDataSeries()
      lsReg = linreg.LeastSquaresRegression(seqDS, 3)
  
      nextDateTime = datetime.datetime(2012, 1, 1)
      seqDS.appendWithDateTime(nextDateTime, 1)
      self.assertEqual(lsReg[-1], None)
  
      nextDateTime = nextDateTime + datetime.timedelta(hours=1)
      seqDS.appendWithDateTime(nextDateTime, 2)
      self.assertEqual(lsReg[-1], None)
  
      # Check current value.
      nextDateTime = nextDateTime + datetime.timedelta(hours=1)
      seqDS.appendWithDateTime(nextDateTime, 3)
      self.assertEqual(round(lsReg[-1], 2), 3)
  
      # Check future values.
      futureDateTime = nextDateTime + datetime.timedelta(hours=1)
      self.assertEqual(round(lsReg.getValueAt(futureDateTime), 2), 4)
      futureDateTime = futureDateTime + datetime.timedelta(minutes=30)
      self.assertEqual(round(lsReg.getValueAt(futureDateTime), 2), 4.5)
      futureDateTime = futureDateTime + datetime.timedelta(minutes=30)
      self.assertEqual(round(lsReg.getValueAt(futureDateTime), 2), 5)
  
      # Move forward in sub-second increments.
      nextDateTime = nextDateTime + datetime.timedelta(milliseconds=50)
      seqDS.appendWithDateTime(nextDateTime, 4)
      nextDateTime = nextDateTime + datetime.timedelta(milliseconds=50)
      seqDS.appendWithDateTime(nextDateTime, 5)
      self.assertEqual(round(lsReg[-1], 2), 5)
  
file_path: pyalgotrade/testcases/technical_linreg_test.py
imports: import datetime
  from .None import common
  from pyalgotrade.technical import linreg
  from pyalgotrade import dataseries
label_desc: Use image node_id 4 for calling the LeastSquaresRegressionTestCase obj's underlying member method code with example usage: obj.testStraightLine() without return types