<s> """<STR_LIT>""" <EOL> import logging <EOL> import unittest <EOL> from gensim import utils <EOL> class TestIsCorpus ( unittest . TestCase ) : <EOL> def test_None ( self ) : <EOL> result = utils . is_corpus ( None ) <EOL> expected = ( False , None ) <EOL> self . assertEqual ( expected , result ) <EOL> def test_simple_lists_of_tuples ( self ) : <EOL> potentialCorpus = [ [ ( <NUM_LIT:0> , <NUM_LIT> ) ] ] <EOL> result = utils . is_corpus ( potentialCorpus ) <EOL> expected = ( True , potentialCorpus ) <EOL> self . assertEqual ( expected , result ) <EOL> potentialCorpus = [ [ ( <NUM_LIT:0> , <NUM_LIT> ) , ( <NUM_LIT:1> , <NUM_LIT> ) ] ] <EOL> result = utils . is_corpus ( potentialCorpus ) <EOL> expected = ( True , potentialCorpus ) <EOL> self . assertEqual ( expected , result ) <EOL> potentialCorpus = [ [ ( <NUM_LIT:0> , <NUM_LIT> ) , ( <NUM_LIT:1> , <NUM_LIT> ) , ( <NUM_LIT:2> , <NUM_LIT> ) , ( <NUM_LIT:3> , <NUM_LIT> ) ] ] <EOL> result = utils . is_corpus ( potentialCorpus ) <EOL> expected = ( True , potentialCorpus ) <EOL> self . assertEqual ( expected , result ) <EOL> potentialCorpus = [ [ ( <NUM_LIT:0> , <NUM_LIT> ) ] , [ ( <NUM_LIT:1> , <NUM_LIT> ) ] ] <EOL> result = utils . is_corpus ( potentialCorpus ) <EOL> expected = ( True , potentialCorpus ) <EOL> self . assertEqual ( expected , result ) <EOL> potentialCorpus = [ [ ( <NUM_LIT:0> , <NUM_LIT> ) ] , [ ( <NUM_LIT:1> , <NUM_LIT> ) ] , [ ( <NUM_LIT:2> , <NUM_LIT> ) ] , [ ( <NUM_LIT:3> , <NUM_LIT> ) ] ] <EOL> result = utils . is_corpus ( potentialCorpus ) <EOL> expected = ( True , potentialCorpus ) <EOL> self . assertEqual ( expected , result ) <EOL> def test_int_tuples ( self ) : <EOL> potentialCorpus = [ [ ( <NUM_LIT:0> , <NUM_LIT:4> ) ] ] <EOL> result = utils . is_corpus ( potentialCorpus ) <EOL> expected = ( True , potentialCorpus ) <EOL> self . assertEqual ( expected , result ) <EOL> def test_invalid_formats ( self ) : <EOL> potentials = list ( ) <EOL> potentials . append ( [ "<STR_LIT>" ] ) <EOL> potentials . append ( "<STR_LIT>" ) <EOL> potentials . append ( [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> potentials . append ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:5> ] ) <EOL> potentials . append ( [ [ ( <NUM_LIT:0> , '<STR_LIT:string>' ) ] ] ) <EOL> for noCorpus in potentials : <EOL> result = utils . is_corpus ( noCorpus ) <EOL> expected = ( False , noCorpus ) <EOL> self . assertEqual ( expected , result ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> logging . root . setLevel ( logging . WARNING ) <EOL> unittest . main ( ) </s>
