Skip to content

Simplify Doctests #122

@samimak37

Description

@samimak37

In several functions, we have doctests that are effectively info-dumping a large and complex dictionary. This might be fine for internal tests, but we should simplify the doctests for user readability. For instance:

>>> from gender_analysis.corpus import Corpus
>>> from gender_analysis.common import TEST_DATA_PATH
>>> filepath = TEST_DATA_PATH / 'test_corpus'
>>> csvpath = TEST_DATA_PATH / 'test_corpus' / 'test_corpus.csv'
>>> subject_vs_object_pronoun_freqs(Corpus(filepath, csv_path=csvpath))
({<Document (aanrud_longfrock)>: 0.7947761194029851, <Document (abbott_flatlandromance)>: 0.6775956284153005, <Document (abbott_indiscreetletter)>: 0.7938931297709924, <Document (adams_fighting)>: 0.7188093730208993, <Document (alcott_josboys)>: 0.6339066339066339, <Document (alcott_littlemen)>: 0.6444245409762652, <Document (alcott_littlewomen)>: 0.6580560420315237, <Document (alden_chautauqua)>: 0.7583798882681564, <Document (austen_emma)>: 0.7038087520259318, <Document (austen_persuasion)>: 0.6743697478991596}, {<Document (aanrud_longfrock)>: 0.5380577427821522, <Document (abbott_flatlandromance)>: 0.21666666666666667, <Document (abbott_indiscreetletter)>: 0.4457831325301205, <Document (adams_fighting)>: 0.4358523725834798, <Document (alcott_josboys)>: 0.38636363636363635, <Document (alcott_littlemen)>: 0.43631613324624424, <Document (alcott_littlewomen)>: 0.41256335988414194, <Document (alden_chautauqua)>: 0.5462994836488813, <Document (austen_emma)>: 0.4831533477321814, <Document (austen_persuasion)>: 0.48742004264392325})

This outputted dictionary is much too long to act as a meaningful example for someone that is trying to understand the function, and we could probably simplify it by just breaking up the output into different components or trimming down the dictionary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationmetaGeneral notes or goals

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions