<s> import os <EOL> from stdnet import odm <EOL> from stdnet . utils import test , encoders <EOL> try : <EOL> from stdnet . apps . columnts import npts <EOL> from dynts import tsname <EOL> nptsColumnTS = npts . ColumnTS <EOL> class ColumnTimeSeriesNumpy ( odm . StdModel ) : <EOL> ticker = odm . SymbolField ( unique = True ) <EOL> data = npts . ColumnTSField ( ) <EOL> except ImportError : <EOL> nptsColumnTS = None <EOL> ColumnTimeSeriesNumpy = None <EOL> from . import main <EOL> skipUnless = test . unittest . skipUnless <EOL> @ skipUnless ( nptsColumnTS , '<STR_LIT>' ) <EOL> class TestDynTsIntegration ( main . TestOperations ) : <EOL> ColumnTS = nptsColumnTS <EOL> def testGetFields ( self ) : <EOL> ts1 = self . create ( ) <EOL> ts = ts1 . irange ( ) <EOL> self . assertEqual ( ts . count ( ) , <NUM_LIT:6> ) <EOL> d1 , v1 = ts1 . front ( ) <EOL> d2 , v2 = ts1 . back ( ) <EOL> self . assertTrue ( d2 > d1 ) <EOL> def testEmpty ( self ) : <EOL> session = self . session ( ) <EOL> ts1 = session . add ( self . ColumnTS ( ) ) <EOL> ts = ts1 . irange ( ) <EOL> self . assertEqual ( len ( ts ) , <NUM_LIT:0> ) <EOL> self . assertFalse ( ts1 . front ( ) ) <EOL> self . assertFalse ( ts1 . back ( ) ) <EOL> def testgetFieldInOrder ( self ) : <EOL> ts1 = self . create ( ) <EOL> ts = ts1 . irange ( fields = ( '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ) ) <EOL> self . assertEqual ( ts . count ( ) , <NUM_LIT:3> ) <EOL> self . assertEqual ( ts . name , tsname ( '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ) ) <EOL> def testgetItem ( self ) : <EOL> ts1 = self . create ( ) <EOL> dates = list ( ts1 ) <EOL> N = len ( dates ) <EOL> self . assertTrue ( N ) <EOL> n = N // <NUM_LIT:2> <EOL> dte = dates [ n ] <EOL> v = ts1 [ dte ] </s>
