odk_to_spss_syntax.test package

Submodules

odk_to_spss_syntax.test.test_export_from_json module

Created on Jun 14, 2014

@author: esmail

class odk_to_spss_syntax.test.test_export_from_json.TestCli(methodName='runTest')[source]

Bases: odk_to_spss_syntax.test.test_export_from_json.TestExportFromJson

Test the command line interface building on functionality from TestExportFromJson.

assert_cli_functionality(argv)[source]

Reusable test of the command line interface.

setUp()[source]

Specify a temporary output file.

tearDown()[source]

Delete the temporary output file if it was created.

test_cli()[source]

Test the command line interface.

test_cli_sys_argv()[source]

Test the command line interface using a mocked sys.argv.

class odk_to_spss_syntax.test.test_export_from_json.TestExportFromJson(methodName='runTest')[source]

Bases: unittest.case.TestCase

Integration tests for the exporting of variable metadata from JSON-formatted ODK forms to SPSS ”.sps” syntax files.

assert_syntaxes_equivalent(exported_spss_syntax, canonical_spss_syntax)[source]

Reusable assertion to compare two SPSS syntax texts.

setUp()[source]
test_export_from_json()[source]

Load a JSON-formatted ODK form from file and test the generated SPSS syntax output against a canonical output example.

odk_to_spss_syntax.test.test_export_spss_syntax module

Created on Jun 14, 2014

@author: Esmail Fadae

class odk_to_spss_syntax.test.test_export_spss_syntax.TestExportSpssSyntax(methodName='runTest')[source]

Bases: unittest.case.TestCase

Test exporting SPSS ”.sps” syntax files from VariableMetadata objects.

assert_correct_export(variable_metadata_list)[source]

Reusable assertion for testing with various inputs.

setUp()[source]

Create a VariableMetadata object for use in multiple tests.

test_export_multiple_variables()[source]

Test exporting the metadata of multiple variables.

test_export_single_variable()[source]

Test exporting a single variable’s metadata.

test_export_zero_variables()[source]

Test exporting zero variables (to increase test coverage).

odk_to_spss_syntax.test.test_export_spss_syntax.parse_spss_syntax(test_case, spss_syntax_text)[source]

Check the formatting of the provided syntax text, checking for a variable labels section and possibly a value labels section. Return any parsed variable labels and value labels.

:param unittest.TestCase test_case: Making this an explicit parameter allows this function to be called from any unittest.TestCase descendant. :param str spss_syntax_text: The text of a SPSS ”.sps” syntax file. :return: A dictionary of parsed mappings from variable names to their corresponding labels. Another dictionary with an entry for each variable with parsed mappings from value names to value labels. :rtype: tuple(dict, dict)

odk_to_spss_syntax.test.test_import_json module

Created on Jun 14, 2014

@author: Esmail Fadae

class odk_to_spss_syntax.test.test_import_json.TestImportJson(methodName='runTest')[source]

Bases: unittest.case.TestCase

Test parsing variable metadata from a JSON form into VariableMetadata objects.

setUp()[source]

Create a JSON form string to test against.

test_import_single_variable()[source]

Test importing of a single-variable form.

Module contents