SciPy
Need help? Have a feature request? Please check out the tethne-users group .

tethne.tests package

Submodules

tethne.tests.test_analyze_corpus module

class tethne.tests.test_analyze_corpus.TestBurstness(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_burstness()[source]
test_feature_burstness_()[source]
class tethne.tests.test_analyze_corpus.TestFeatureBurstness(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_feature_burstness()[source]
test_feature_burstness_nonorm()[source]
class tethne.tests.test_analyze_corpus.TestSigma(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_sigma()[source]

tethne.tests.test_analyze_features module

class tethne.tests.test_analyze_features.TestAngularSimilarity(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_angular_similarity()[source]
test_angular_similarity_citations()[source]
class tethne.tests.test_analyze_features.TestCosineSimilarity(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_cosine_similarity()[source]
test_cosine_similarity_citations()[source]
class tethne.tests.test_analyze_features.TestKLDivergence(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_kl_divergence()[source]
test_kl_divergence_citations()[source]

tethne.tests.test_analyze_graph module

class tethne.tests.test_analyze_graph.TestGlobalCloseness(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_global_closeness()[source]
test_global_closeness_node()[source]

tethne.tests.test_classes_corpus module

class tethne.tests.test_classes_corpus.TestCorpus(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_distribution()[source]
test_feature_distribution()[source]
test_featureselector()[source]
test_getitem()[source]
test_indexing()[source]

Check for successful indexing.

test_init()[source]

Check for clean initialization.

test_slice()[source]
test_slice_index_only()[source]
test_slice_larger()[source]
test_slice_larger_index_only()[source]
test_slice_sliding()[source]
test_slice_sliding_index_only()[source]
test_top_features()[source]

tethne.tests.test_classes_feature module

class tethne.tests.test_classes_feature.TestFeature(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_extend()[source]
test_iadd()[source]
test_init_counts()[source]

Initialize with a list of 2-tuple token values.

test_init_datum()[source]

Initialize with a single token.

test_init_list()[source]

Initialize with a list of tokens.

test_init_tuples()[source]
test_isub()[source]
test_norm()[source]
class tethne.tests.test_classes_feature.TestFeatureSet(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_add_feature()[source]

Initialize empty, then add a feature.

test_as_matrix()[source]
test_as_vector()[source]
test_empty_feature()[source]
test_end_to_end()[source]

Runs the Gensim LDA workflow (https://radimrehurek.com/gensim/wiki.html#latent-dirichlet-allocation).

test_end_to_end_raw()[source]

Runs the Gensim LDA workflow (https://radimrehurek.com/gensim/wiki.html#latent-dirichlet-allocation).

test_init_empty()[source]

Initialize with no Features.

test_init_features()[source]

Initialize with multiple features.

test_top()[source]
test_transform()[source]
class tethne.tests.test_classes_feature.TestFeatureSetWithData(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_featureset()[source]

tethne.tests.test_classes_graphcollection module

class tethne.tests.test_classes_graphcollection.TestGraphCollectionCreation(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_add()[source]

Add a networkx.Graph to the GraphCollection.

test_build()[source]
test_build_streaming()[source]
test_index()[source]

Index a networkx.Graph, but don’t add it to the GraphCollection.

test_init()[source]
test_init_build()[source]

Should build graphs if passed a corpus and method.

test_init_build_streaming()[source]

Should build graphs if passed a corpus and method.

test_init_directed()[source]
class tethne.tests.test_classes_graphcollection.TestGraphCollectionMethods(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_analyze()[source]
test_analyze_edge()[source]
test_analyze_graph()[source]
test_analyze_path()[source]
test_collapse()[source]
test_edge_history()[source]
test_edges()[source]

GraphCollection.edges() should behave like networkx.Graph.edges(), but return values for all of the networkx.Graphs in the GraphCollection.

test_getattr()[source]

Can retrieve a graph as an attribute of the GraphCollection.

test_node_history()[source]
test_nodes()[source]

GraphCollection.nodes() should behave like networkx.Graph.nodes(), but return values for all of the networkx.Graphs in the GraphCollection.

test_order()[source]

GraphCollection.order() should return the number of nodes in the GraphCollection. If piecewise is True, should return a dict containing the order of each networkx.Graph in the GraphCollection.

test_size()[source]

GraphCollection.size() should return the number of nodes in the GraphCollection. If piecewise is True, should return a dict containing the size of each networkx.Graph in the GraphCollection.

test_union()[source]

tethne.tests.test_classes_streamingcorpus module

class tethne.tests.test_classes_streamingcorpus.TestStreamingCorpus(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_distribution()[source]
test_feature_distribution()[source]
test_featureselector()[source]
test_getitem()[source]
test_indexing()[source]

Check for successful indexing.

test_init()[source]

Check for clean initialization.

test_slice()[source]
test_slice_larger()[source]
test_slice_sliding()[source]
test_top_features()[source]

tethne.tests.test_classes_structuredfeature module

class tethne.tests.test_classes_structuredfeature.TestStructuredFeature(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_add_context()[source]
test_init()[source]
test_select()[source]
test_select_chunk()[source]
class tethne.tests.test_classes_structuredfeature.TestStructuredFeatureSet(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_init()[source]
test_select_context()[source]
test_transform()[source]
class tethne.tests.test_classes_structuredfeature.TestStructuredFeatureSetToGensim(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_end_to_end()[source]

Runs the Gensim LDA workflow (https://radimrehurek.com/gensim/wiki.html#latent-dirichlet-allocation).

test_end_to_end_raw()[source]

Runs the Gensim LDA workflow (https://radimrehurek.com/gensim/wiki.html#latent-dirichlet-allocation).

test_to_gensim_corpus()[source]

tethne.tests.test_model_social_tapmodel module

tethne.tests.test_models_lda module

class tethne.tests.test_models_lda.TestHelpers(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_mallet_to_phi_featureset()[source]
test_mallet_to_theta_featureset()[source]
class tethne.tests.test_models_lda.TestLDAModel(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_ldamodel()[source]
test_networks()[source]
class tethne.tests.test_models_lda.TestLDAModelExistingOutput(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_load_existing_data()[source]
test_load_existing_data_staticmethod()[source]
class tethne.tests.test_models_lda.TestLDAModelMALLETPath(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_direct_import()[source]
class tethne.tests.test_models_lda.TestLDAModelUnstructured(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_ldamodel()[source]
test_networks()[source]
class tethne.tests.test_models_lda.TestLDAModelWithTransformation(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_ldamodel()[source]
test_networks()[source]

tethne.tests.test_networks_authors module

class tethne.tests.test_networks_authors.TestAuthorPapers(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_author_papers()[source]
class tethne.tests.test_networks_authors.TestCoauthors(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_author_papers()[source]

tethne.tests.test_networks_base module

class tethne.tests.test_networks_base.TestBaseNetworkMethods(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_coocurrence()[source]
test_coocurrence_feature()[source]
test_coupling()[source]
test_coupling_feature()[source]
test_coupling_min_weight()[source]

Limit edges to weight >= 3.

test_multipartite()[source]
class tethne.tests.test_networks_base.TestBaseNetworkMethodsWithStreaming(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_coocurrence()[source]
test_coocurrence_feature()[source]
test_coupling()[source]
test_coupling_feature()[source]
test_coupling_min_weight()[source]

Limit edges to weight >= 3.

test_multipartite()[source]

tethne.tests.test_networks_features module

class tethne.tests.test_networks_features.TestAuthorPapers(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_feature_cooccurrence()[source]
test_keyword_cooccurrence()[source]
test_mutual_information()[source]

tethne.tests.test_networks_helpers module

class tethne.tests.test_networks_helpers.TestCitationCount(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_citation_count()[source]
class tethne.tests.test_networks_helpers.TestSimplifyMultigraph(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_simplify_multigraph()[source]

PURPOSE :To Test the simplify_Multigraph functionality.

DESCRIPTION : simplify_graph takes as input a multigraph i.e a graph having parallel edges in between 2 vertices/nodes and converts it to a simple graph i.e. with only one edge in between two nodes. And the weight of the new edge is equal to the number of edges that were collapsed.

TESTED FOR
: 1) Collapsed edges between vertices.
  1. Weight of the new edges

TEST DATA : any Multigraph.

tethne.tests.test_networks_papers module

class tethne.tests.test_networks_papers.TestAuthorPapers(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_author_coupling()[source]
test_bibliographic_coupling()[source]
test_cocitation()[source]
test_direct_citation()[source]
class tethne.tests.test_networks_papers.TestAuthorPapersWithStreaming(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_author_coupling()[source]
test_bibliographic_coupling()[source]
test_cocitation()[source]
test_direct_citation()[source]

tethne.tests.test_readers_base module

class tethne.tests.test_readers_base.TestFTParser(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_badpath()[source]

If an invalid/non-existant path is passed to the constructor, should raise an IOError.

test_handle()[source]

handle should store the first line of data in the first data entry.

test_next()[source]

next should return the first line of data.

test_parse()[source]
test_start()[source]

Parser should advance to the first start tag, and instantiate the first data entry.

class tethne.tests.test_readers_base.TestXMLParser(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_handle()[source]

handle should store the first line of data in the first data entry.

test_parse()[source]

tethne.tests.test_readers_dfr module

class tethne.tests.test_readers_dfr.TestCitationFile(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_citations_file()[source]
class tethne.tests.test_readers_dfr.TestCreateAyijid(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_all_None_args()[source]
test_no_auinit()[source]
test_no_aulast()[source]
class tethne.tests.test_readers_dfr.TestDFRReader(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_read()[source]
test_transform()[source]
class tethne.tests.test_readers_dfr.TestDFRReaderStreaming(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_read()[source]
class tethne.tests.test_readers_dfr.TestDfr2PaperMap(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_dfr2paper()[source]
class tethne.tests.test_readers_dfr.TestHandleAuthor(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_handle_author_JR()[source]
test_handle_author_NOJR()[source]
class tethne.tests.test_readers_dfr.TestHandleAuthors(methodName='runTest')[source]

Bases: unittest.case.TestCase

testing the functionality when the input parameter is list

test_handle_authors_String()[source]
test_handle_authors_list()[source]
class tethne.tests.test_readers_dfr.TestHandlePageRange(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_handle_pagerange()[source]
test_handle_pagerange_noNumbers()[source]
class tethne.tests.test_readers_dfr.TestHandlePaper(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_handle_Paper()[source]
class tethne.tests.test_readers_dfr.TestNGrams(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_float_weights()[source]

Some DfR features have floating-point weights, rather than ints.

test_ngrams()[source]

tethne.tests.test_readers_merge module

class tethne.tests.test_readers_merge.TestMerge(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_merge()[source]
test_merge_both_empty()[source]

Testing the functionality of merge when both lists passed are empty

test_merge_comparator()[source]

Instead of passing a list of fields to compare, we can pass a callable object that returns bool.

test_merge_equal()[source]

Testing the functionality of merge by passing two lists with 1 field each and field’s values in both are equal

test_merge_not_equal()[source]

Testing the functionality of merge by passing two lists with 1 field each and field’s values in both are not equal

test_merge_one_empty()[source]

Testing the functionality of merge when one of the lists passed is empty

tethne.tests.test_readers_scopus module

class tethne.tests.test_readers_scopus.MyTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

tethne.tests.test_readers_wos module

class tethne.tests.test_readers_wos.TestWithStarCR(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_citedRefs()[source]
class tethne.tests.test_readers_wos.TestWoSParser(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_parse()[source]
test_read()[source]
test_read_nocorpus()[source]
class tethne.tests.test_readers_wos.TestWoSParserStreaming(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_read()[source]
tethne.tests.test_readers_wos.is_number(value)[source]

tethne.tests.test_readers_zotero module

class tethne.tests.test_readers_zotero.TestInferSpaces(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_infer()[source]
class tethne.tests.test_readers_zotero.TestZoteroDuplicates(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_duplicate_Papers_length()[source]

Tests for user-warning raised in case of duplicate papers in a Corpus. Definition of duplicate papers is : Papers which have the same index_by field value. Example :

Two papers in a Zotero collection, with the same URI, are duplicates Two papers from World of Science with the same WOSID are duplicates

Returns:

Fails when the attribute duplicate_papers(Dictionary) is not populated.

duplicate_papers[‘http://www.jstor.org/stable/2460126‘] = 2

This means there are 2 papers with the URI ‘http://www.jstor.org/stable/2460126

class tethne.tests.test_readers_zotero.TestZoteroParser(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_authors()[source]

Tests for empty author names for each paper in a ZOTERO Corpus

Returns:Fails : When the author-name is empty, it fails
test_authors_full()[source]

Tests for empty author_full names for each paper in a ZOTERO Corpus

Returns:Fails : When the author_full names is empty, it fails.
test_handle_date()[source]
test_parse()[source]
test_read()[source]
test_read_files()[source]
test_read_nocorpus()[source]

tethne.tests.test_utilities module

class tethne.tests.test_utilities.TestArgMax(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_arg_max_num()[source]
test_arg_max_str()[source]
class tethne.tests.test_utilities.TestAttribsToString(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_attribs()[source]
class tethne.tests.test_utilities.TestConcatList(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_EqualSize()[source]
test_EqualSize_Default()[source]
class tethne.tests.test_utilities.TestContains(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_contains_false()[source]
test_contains_true()[source]
class tethne.tests.test_utilities.TestDictFromNode(methodName='runTest')[source]

Bases: unittest.case.TestCase

Testing the functionality when there are more than one node of the same type and the resultants values are in propertly obtained in the list and also when there is only node of a type, the resultant is a String

test_dict_from_node()[source]
test_dict_from_node_rec_True()[source]
test_dict_from_node_rec_false()[source]
class tethne.tests.test_utilities.TestGetItem(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_key_int()[source]
test_key_str()[source]
class tethne.tests.test_utilities.TestOverlap(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_both_not_empty()[source]
test_empty_listA()[source]
test_empty_listB()[source]
class tethne.tests.test_utilities.TestSetItem(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_key_int()[source]
test_key_str()[source]
class tethne.tests.test_utilities.TestStripPunctual2(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_empty_string()[source]
test_string()[source]
class tethne.tests.test_utilities.TestStripPunctuation(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_str()[source]
test_unicode()[source]
class tethne.tests.test_utilities.TestSubDict(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_NonEmpty()[source]

tethne.tests.test_writers_collection module

class tethne.tests.test_writers_collection.TestToDXGMML(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_write_dxgmml()[source]

tethne.tests.test_writers_corpus module

class tethne.tests.test_writers_corpus.WriteDocumentsDTMTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_write_documents_dtm()[source]
class tethne.tests.test_writers_corpus.WriteDocumentsTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_write_documents()[source]

tethne.tests.test_writers_graph module

class tethne.tests.test_writers_graph.CSVTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
tearDown()[source]
test_write_csv()[source]
class tethne.tests.test_writers_graph.GraphMLTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
tearDown()[source]
test_write_graphml()[source]
class tethne.tests.test_writers_graph.TestToSif(methodName='runTest')[source]

Bases: unittest.case.TestCase

testBasic()[source]
testGraphZeroEdges()[source]
testMultiGraph()[source]

Module contents