‘jsondata.Selftest’ - Module

Test of basic features for the user by ‘–selftest’.

This module is used by ‘jsondc’ when the opverify_data_schemaardoced basic functional checks by calling ‘runselftest’.

The display of actions and results could be activated and raised by multiple repetition of the ‘-v’ option.

The following data and schema are applied:
  1. jsondata/data.json + jsondata/schema.jsd
  2. jsondata/datacheck.json + jsondata/datacheck.jsd
The performed process flow is:
  1. load
  2. validate
  3. verify

By default either ‘True’ is returned, or in case of a failed test and/or error condition an exception is raised.

Basic

  • runselftest
jsondata.Selftest.runselftest(appname='selftest', **kargs)[source]

Performs the selftest returns True or False. Executes some the basic runtime test cases for user verification.

Args:
appname: Name of the application. Changing this may break the
selftest. default:=selftest
**kargs:
debug: Displays extended state data for developers.
Requires __debug__==True.
verbose: Extends the amount of the display of
processing data.
_verbose=#levels: Extends the amount of the display
of processing data by given number of levels at once.
Returns:
Selftest object.
Raises:
bypassed subsystems
  • printverbose
jsondata.Selftest.printverbose(lvl, args)[source]

Load Tests

  • load_data
jsondata.Selftest.load_data(appname)[source]

Loads and verifies the self test ‘data.json’.

Therefore the result of the creation of JSONDataSerializer is compared to the load by json.load().

  • load_appname
jsondata.Selftest.load_appname(appname)[source]

Loads and verifies the self test ‘selftest.json’.

Therefore the result of the creation of JSONDataSerializer is compared to the load by json.load().

Validation Tests

  • verify_data_schema
jsondata.Selftest.verify_data_schema(appname)[source]

Loads and validates the self test ‘data.json’ and ‘schema.jsd’.

Therefore the result of the creation of JSONDataSerializer is performed with draft3 validation by jsonschema.validate().

  • verify_appname_schema
jsondata.Selftest.verify_appname_schema(appname)[source]

Loads and validates the self test ‘selftest.json’ and ‘selftest.jsd’.

Therefore the result of the creation of JSONDataSerializer is performed with draft3 validation by jsonschema.validate().

JSONPointer tests

  • jsonpointer_data_schema
jsondata.Selftest.jsonpointer_data_schema(appname)[source]

Loads and verifies by using JSONPointer access ‘data.json’.

  • jsonpointer_selftest_data
jsondata.Selftest.jsonpointer_selftest_data(appname)[source]

Loads and verifies by using JSONPointer access ‘selftest.json’.

  • jsonpointer_selftest_data_schema
jsondata.Selftest.jsonpointer_selftest_data_schema(appname)[source]

Loads and verifies by using JSONPointer access ‘selftest.json’.