<s> import unittest2 as unittest <EOL> import numpy as np <EOL> from vsm . viewer . beagleviewer import BeagleViewer <EOL> from vsm . viewer . labeleddata import * <EOL> class TestBeagleViewer ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> from vsm . corpus . util . corpusbuilders import random_corpus <EOL> from vsm . model . beagleenvironment import BeagleEnvironment <EOL> from vsm . model . beaglecontext import BeagleContextSeq <EOL> from vsm . model . beagleorder import BeagleOrderSeq <EOL> from vsm . model . beaglecomposite import BeagleComposite <EOL> ec = random_corpus ( <NUM_LIT:1000> , <NUM_LIT:50> , <NUM_LIT:0> , <NUM_LIT:20> , context_type = '<STR_LIT>' ) <EOL> cc = ec . apply_stoplist ( stoplist = [ str ( i ) for i in xrange ( <NUM_LIT:0> , <NUM_LIT:50> , <NUM_LIT:7> ) ] ) <EOL> e = BeagleEnvironment ( ec , n_cols = <NUM_LIT:5> ) <EOL> e . train ( ) <EOL> cm = BeagleContextSeq ( cc , ec , e . matrix ) <EOL> cm . train ( ) <EOL> om = BeagleOrderSeq ( ec , e . matrix ) <EOL> om . train ( ) <EOL> m = BeagleComposite ( cc , cm . matrix , ec , om . matrix ) <EOL> m . train ( ) <EOL> self . venv = BeagleViewer ( ec , e ) <EOL> self . vctx = BeagleViewer ( cc , cm ) <EOL> self . vord = BeagleViewer ( ec , om ) <EOL> self . vcom = BeagleViewer ( cc , m ) <EOL> def test_BeagleViewer ( self ) : <EOL> sww = self . venv . dist_word_word ( '<STR_LIT:1>' ) <EOL> sww1 = self . vord . dist_word_word ( '<STR_LIT:0>' ) <EOL> self . assertTrue ( type ( sww ) == LabeledColumn ) <EOL> self . assertTrue ( type ( sww1 ) == LabeledColumn ) <EOL> smw = self . vcom . dismat_word ( [ '<STR_LIT:1>' ] ) <EOL> smw1 = self . vctx . dismat_word ( [ '<STR_LIT:1>' ] ) <EOL> self . assertTrue ( type ( smw ) == IndexedSymmArray ) <EOL> self . assertTrue ( type ( smw1 ) == IndexedSymmArray ) <EOL> suite = unittest . TestLoader ( ) . loadTestsFromTestCase ( TestBeagleViewer ) <EOL> unittest . TextTestRunner ( verbosity = <NUM_LIT:2> ) . run ( suite ) </s>
