<s> import apgl <EOL> from apgl . graph . VertexList import VertexList <EOL> from apgl . util import * <EOL> from apgl . graph . test . MatrixGraphTest import MatrixGraphTest <EOL> import unittest <EOL> import numpy <EOL> try : <EOL> from apgl . graph . CsArrayGraph import CsArrayGraph <EOL> except ImportError : <EOL> pass <EOL> @ apgl . skipIf ( not apgl . checkImport ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> class CsArrayGraphTest ( unittest . TestCase , MatrixGraphTest ) : <EOL> def setUp ( self ) : <EOL> self . GraphType = CsArrayGraph <EOL> self . initialise ( ) <EOL> def testInit ( self ) : <EOL> numVertices = <NUM_LIT:0> <EOL> numFeatures = <NUM_LIT:1> <EOL> vList = VertexList ( numVertices , numFeatures ) <EOL> graph = CsArrayGraph ( vList ) <EOL> self . assertEquals ( graph . weightMatrixDType ( ) , numpy . float ) <EOL> graph = CsArrayGraph ( vList , dtype = numpy . int16 ) <EOL> self . assertEquals ( graph . weightMatrixDType ( ) , numpy . int16 ) <EOL> graph = CsArrayGraph ( numVertices ) <EOL> self . assertEquals ( graph . size , numVertices ) <EOL> def testAddVertices ( self ) : <EOL> graph = CsArrayGraph ( <NUM_LIT:10> ) <EOL> graph [ <NUM_LIT:3> , <NUM_LIT:4> ] = <NUM_LIT:1> <EOL> graph . addVertices ( <NUM_LIT:5> ) <EOL> self . assertEquals ( graph [ <NUM_LIT:3> , <NUM_LIT:4> ] , <NUM_LIT:1> ) <EOL> self . assertEquals ( graph . getNumEdges ( ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( graph . size , <NUM_LIT:15> ) <EOL> graph [ <NUM_LIT:10> , <NUM_LIT:11> ] = <NUM_LIT:0.1> <EOL> graph . addVertices ( <NUM_LIT:5> ) <EOL> self . assertEquals ( graph [ <NUM_LIT:3> , <NUM_LIT:4> ] , <NUM_LIT:1> ) <EOL> self . assertEquals ( graph [ <NUM_LIT:10> , <NUM_LIT:11> ] , <NUM_LIT:0.1> ) <EOL> self . assertEquals ( graph . getNumEdges ( ) , <NUM_LIT:2> ) <EOL> self . assertEquals ( graph . size , <NUM_LIT:20> ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
