armi.utils.tests.test_tabulate module

Tests for tabulate.

This file started out as the MIT-licensed “tabulate”. Though we have made, and will continue to make many arbitrary changes as we need. Thanks to the tabulate team.

https://github.com/astanin/python-tabulate

class armi.utils.tests.test_tabulate.TestTabulateAPI(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_tabulateFormats()[source]

API: tabulateFormats is a list of strings.

class armi.utils.tests.test_tabulate.TestTabulateInputs(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_iterableOfEmpties()[source]

Input: test various empty inputs.

test_iterableOfIterables()[source]

Input: an interable of iterables.

test_iterableOfIterablesHeaders()[source]

Input: an interable of iterables with headers.

test_iterableOfIterablesFirstrow()[source]

Input: an interable of iterables with the first row as headers.

test_listOfLists()[source]

Input: a list of lists with headers.

test_listOfListsFirstrow()[source]

Input: a list of lists with the first row as headers.

test_listOfListsKeys()[source]

Input: a list of lists with column indices as headers.

test_dictLike()[source]

Input: a dict of iterables with keys as headers.

test_numpy2d()[source]

Input: a 2D NumPy array with headers.

test_numpy2dFirstrow()[source]

Input: a 2D NumPy array with the first row as headers.

test_numpy2dKeys()[source]

Input: a 2D NumPy array with column indices as headers.

test_numpyRecordArray()[source]

Input: a 2D NumPy record array without header.

test_numpyRecordArrayKeys()[source]

Input: a 2D NumPy record array with column names as headers.

test_numpyRecordArrayHeaders()[source]

Input: a 2D NumPy record array with user-supplied headers.

test_listOfNamedtuples()[source]

Input: a list of named tuples with field names as headers.

test_listOfNamedtuplesKeys()[source]

Input: a list of named tuples with field names as headers.

test_listOfDicts()[source]

Input: a list of dictionaries.

test_listOfUserdicts()[source]

Input: a list of UserDicts.

test_listOfDictsKeys()[source]

Input: a list of dictionaries, with keys as headers.

test_listOfUserdictsKeys()[source]

Input: a list of UserDicts.

test_listOfDictsWithMissingKeys()[source]

Input: a list of dictionaries, with missing keys.

test_listOfDictsFirstrow()[source]

Input: a list of dictionaries, with the first dict as headers.

test_listOfDictsWithDictOfHeaders()[source]

Input: a dict of user headers for a list of dicts.

test_listOfDictsWithListOfHeaders()[source]

Input: ValueError on a list of headers with a list of dicts.

test_listOfOrdereddicts()[source]

Input: a list of OrderedDicts.

test_listBytes()[source]

Input: a list of bytes.

class armi.utils.tests.test_tabulate.TestTabulateInternal(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_alignColumnDecimal()[source]

Internal: _align_column(…, ‘decimal’).

test_alignColumnDecimalWithThousandSeparators()[source]

Internal: _align_column(…, ‘decimal’).

test_alignColumnDecimalWithIncorrectThousandSeparators()[source]

Internal: _align_column(…, ‘decimal’).

test_alignColumnNone()[source]

Internal: _align_column(…, None).

test_alignColumnMultiline()[source]

Internal: _align_column(…, is_multiline=True).

test_alignCellVeriticallyOneLineOnly()[source]

Internal: Aligning a single height cell is same regardless of alignment value.

test_alignCellVeriticallyTopSingleTextMultiplePad()[source]

Internal: Align single cell text to top.

test_alignCellVeriticallyCenterSingleTextMultiplePad()[source]

Internal: Align single cell text to center.

test_alignCellVeriticallyBottomSingleTextMultiplePad()[source]

Internal: Align single cell text to bottom.

test_alignCellVeriticallyTopMultiTextMultiplePad()[source]

Internal: Align multiline celltext text to top.

test_alignCellVeriticallyCenterMultiTextMultiplePad()[source]

Internal: Align multiline celltext text to center.

test_alignCellVeriticallyBottomMultiTextMultiplePad()[source]

Internal: Align multiline celltext text to bottom.

test_assortedRareEdgeCases()[source]

Test some of the more rare edge cases in the purely internal functions.

test_bool()[source]
test_buildLine()[source]

Basic sanity test of internal _buildLine() function.

test_buildRow()[source]

Basic sanity test of internal _buildRow() function.

test_format()[source]

Basic sanity test of internal _format() function.

test_isMultiline()[source]

Basic sanity test of internal _isMultiline() function.

test_multilineWidth()[source]

Internal: _multilineWidth().

test_normalizeTabularData()[source]

Basic sanity test of internal _normalizeTabularData() function.

test_type()[source]

Basic sanity test of internal _type() function.

test_visibleWidth()[source]

Basic sanity test of internal _visibleWidth() function.

test_wrapTextToColWidths()[source]

Basic sanity test of internal _wrapTextToColWidths() function.

class armi.utils.tests.test_tabulate.TestTabulateOutput(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_plain()[source]

Output: plain with headers.

test_plainHeaderless()[source]

Output: plain without headers.

test_plainMultilineHeaderless()[source]

Output: plain with multiline cells without headers.

test_plainMultiline()[source]

Output: plain with multiline cells with headers.

Output: plain with multiline cells with links and headers.

test_plainMultilineWithEmptyCells()[source]

Output: plain with multiline cells and empty cells with headers.

test_plainMultilineWithEmptyCellsHeaderless()[source]

Output: plain with multiline cells and empty cells without headers.

test_plainMaxcolwidthAutowraps()[source]

Output: maxcolwidth will result in autowrapping longer cells.

test_plainMaxcolwidthAutowrapsWithSep()[source]

Output: maxcolwidth will result in autowrapping longer cells and separating line.

test_maxColWidthsingleValue()[source]

Output: maxcolwidth can be specified as a single number that works for each column.

test_maxcolwidthPadTailingWidths()[source]

Output: maxcolwidth, if only partly specified, pads tailing cols with None.

test_maxcolwidthHonorDisableParsenum()[source]

Output: Using maxcolwidth in conjunction with disable_parsenum is honored.

test_plainmaxHeaderColWidthsAutowraps()[source]

Output: maxHeaderColWidths will result in autowrapping header cell.

test_simple()[source]

Output: simple with headers.

test_simpleWithSepLine()[source]

Output: simple with headers and separating line.

test_readmeExampleWithSep()[source]
test_simpleMultiline2()[source]

Output: simple with multiline cells.

test_simpleMultiline2WithSepLine()[source]

Output: simple with multiline cells.

test_simpleHeaderless()[source]

Output: simple without headers.

test_simpleHeaderlessWithSepLine()[source]

Output: simple without headers.

test_simpleMultilineHeaderless()[source]

Output: simple with multiline cells without headers.

test_simpleMultiline()[source]

Output: simple with multiline cells with headers.

Output: simple with multiline cells with links and headers.

test_simpleMultilineWithEmptyCells()[source]

Output: simple with multiline cells and empty cells with headers.

test_simpleMultilineWithEmptyCellsHeaderless()[source]

Output: simple with multiline cells and empty cells without headers.

test_github()[source]

Output: github with headers.

test_grid()[source]

Output: grid with headers.

test_gridHeaderless()[source]

Output: grid without headers.

test_gridMultilineHeaderless()[source]

Output: grid with multiline cells without headers.

test_gridMultiline()[source]

Output: grid with multiline cells with headers.

test_gridMultilineWithEmptyCells()[source]

Output: grid with multiline cells and empty cells with headers.

test_gridMultilineWithEmptyCellsHeaderless()[source]

Output: grid with multiline cells and empty cells without headers.

test_pretty()[source]

Output: pretty with headers.

test_prettyHeaderless()[source]

Output: pretty without headers.

test_prettyMultilineHeaderless()[source]

Output: pretty with multiline cells without headers.

test_prettyMultiline()[source]

Output: pretty with multiline cells with headers.

Output: pretty with multiline cells with headers.

test_prettyMultilineWithEmptyCells()[source]

Output: pretty with multiline cells and empty cells with headers.

test_prettyMultilineWithEmptyCellsHeaderless()[source]

Output: pretty with multiline cells and empty cells without headers.

test_rst()[source]

Output: rst with headers.

test_rstWithEmptyValuesInFirstColumn()[source]

Output: rst with dots in first column.

test_rstHeaderless()[source]

Output: rst without headers.

test_rstMultiline()[source]

Output: rst with multiline cells with headers.

Output: rst with multiline cells with headers.

test_rstMultilineWithEmptyCells()[source]

Output: rst with multiline cells and empty cells with headers.

test_rstMultilineWithEmptyCellsHeaderless()[source]

Output: rst with multiline cells and empty cells without headers.

test_noData()[source]

Output: table with no data.

test_emptyData()[source]

Output: table with empty data.

test_noDataWithoutHeaders()[source]

Output: table with no data and no headers.

test_emptyDataWithoutHeaders()[source]

Output: table with empty data and no headers.

test_intFmt()[source]

Output: integer format.

test_emptyDataWithHeaders()[source]

Output: table with empty data and headers as firstrow.

test_floatFmt()[source]

Output: floating point format.

test_floatFmtMulti()[source]

Output: floating point format different for each column.

test_colAlignMulti()[source]

Output: string columns with custom colAlign.

test_colAlignMultiWithSepLine()[source]

Output: string columns with custom colAlign.

test_columnGlobalAndSpecificAlignment()[source]

Test colGlobalAlign and “global” parameter for colAlign.

test_headersGlobalAndSpecificAlignment()[source]

Test headersGlobalAlign and headersAlign.

test_colAlignOrheadersAlignTooLong()[source]

Test colAlign and headersAlign too long.

test_floatConversions()[source]

Output: float format parsed.

test_missingVal()[source]

Output: substitution of missing values.

test_missingValMulti()[source]

Output: substitution of missing values with different values per column.

test_columnAlignment()[source]

Output: custom alignment for text and numbers.

test_dictLikeWithIndex()[source]

Output: a table with a running index.

test_listOfListsWithIndex()[source]

Output: a table with a running index.

test_listOfListsWithIndexWithSepLine()[source]

Output: a table with a running index.

test_listOfListsWithSuppliedIndex()[source]

Output: a table with a supplied index.

test_listOfListsWithIndexFirstrow()[source]

Output: a table with a running index and header=’firstrow’.

test_disableNumParseDefault()[source]

Output: Default table output with number parsing and alignment.

test_disableNumParseTrue()[source]

Output: Default table output, but without number parsing and alignment.

test_disableNumParseList()[source]

Output: Default table output, but with number parsing selectively disabled.