Package gavo :: Package rscdef :: Module regtest :: Class RegTest
[frames] | no frames]

Class RegTest

source code

                   object --+                    
                            |                    
 base.structure.StructureBase --+                
                                |                
                   object --+   |                
                            |   |                
           base.common.Parser --+                
                                |                
base.structure.ParseableStructure --+            
                                    |            
             base.structure.Structure --+        
                                        |        
                           object --+   |        
                                    |   |        
      base.structure.RestrictionMixin --+        
                                        |        
                          procdef.ProcDef --+    
                                            |    
                              procdef.ProcApp --+
                                                |
                                   object --+   |
                                            |   |
                       unittest.case.TestCase --+
                                                |
                                               RegTest

A regression test.

Nested Classes

Inherited from base.structure.StructureBase: __metaclass__

Inherited from unittest.case.TestCase: failureException

Instance Methods
 
__init__(self, *args, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
fakeForPyUnit(self) source code
 
retrieveData(self, serverURL, timeout)
returns headers and content when retrieving the resource at url.
source code
 
getDataSource(self)
returns a string pointing people to where data came from.
source code
 
pointNextToLocation(self, addToPath='')
arranges for the value of the location header to become the base URL of the next test.
source code
 
assertHasStrings(self, *strings)
checks that all its arguments are found within content.
source code
 
assertLacksStrings(self, *strings)
checks that all its arguments are *not* found within content.
source code
 
assertHTTPStatus(self, expectedStatus)
checks whether the request came back with expectedStatus.
source code
 
assertValidatesXSD(self)
checks whether the returned data are XSD valid.
source code
 
assertXpath(self, path, assertions)
checks an xpath assertion.
source code
 
getXpath(self, path, element=None)
returns the equivalent of tree.xpath(path) for an lxml etree of the current document or in element, if passed in.
source code
 
assertHeader(self, key, value)
checks that header key has value in the response headers.
source code
 
getFirstVOTableRow(self)
interprets data as a VOTable and returns the first row as a dictionary
source code
 
getVOTableRows(self)
parses the first table in a result VOTable and returns the contents as a sequence of dictionaries.
source code
 
getFullId(self) source code

Inherited from procdef.ProcApp: breakCircles, compile, completeElement, getBodySetupCode, getFuncCode, getLateSetupCode, getParSetupCode, getSetupCode, getSetupPars, onElementComplete, validate

Inherited from procdef.ProcDef: getCode

Inherited from base.structure.Structure: __provides__, callCompletedCallbacks, finishElement

Inherited from base.structure.ParseableStructure: end_, feed, feedFrom, feedObject, getAttribute, iterEvents, start_, value_

Inherited from base.structure.StructureBase: __providedBy__, adopt, change, copy, getAttributes, getCopyableAttributes, getSourcePosition, iterChildren, setPosition

Inherited from base.common.Parser: feedEvent

Inherited from unittest.case.TestCase: __call__, __eq__, __hash__, __ne__, __repr__, __str__, addCleanup, addTypeEqualityFunc, assertAlmostEqual, assertAlmostEquals, assertDictContainsSubset, assertDictEqual, assertEqual, assertEquals, assertFalse, assertGreater, assertGreaterEqual, assertIn, assertIs, assertIsInstance, assertIsNone, assertIsNot, assertIsNotNone, assertItemsEqual, assertLess, assertLessEqual, assertListEqual, assertMultiLineEqual, assertNotAlmostEqual, assertNotAlmostEquals, assertNotEqual, assertNotEquals, assertNotIn, assertNotIsInstance, assertNotRegexpMatches, assertRaises, assertRaisesRegexp, assertRegexpMatches, assertSequenceEqual, assertSetEqual, assertTrue, assertTupleEqual, assert_, countTestCases, debug, defaultTestResult, doCleanups, fail, failIf, failIfAlmostEqual, failIfEqual, failUnless, failUnlessAlmostEqual, failUnlessEqual, failUnlessRaises, id, run, setUp, shortDescription, skipTest, tearDown

Inherited from object: __delattr__, __format__, __getattribute__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Methods

Inherited from base.structure.StructureBase: fromStructure

Inherited from unittest.case.TestCase: setUpClass, tearDownClass

Class Variables
  name_ = 'regTest'
hash(x)
  requiredType = 'regTest'
hash(x)
  formalArgs = 'self'
  runCount = 1
hash(x)
  additionalNamesForProcs = {'EqualingRE': <class 'gavo.utils.co...
  XPATH_NAMESPACE_MAP = {'h': 'http://www.w3.org/1999/xhtml', 'o...
  attrSeq = [<gavo.base.complexattrs.StructListAttribute object>...
  managedAttrs = {'bind': <gavo.base.complexattrs.StructListAttr...

Inherited from base.structure.Structure: __implemented__

Inherited from base.structure.StructureBase: completedCallbacks

Inherited from unittest.case.TestCase: longMessage, maxDiff

Properties
  description
  rd

Inherited from object: __class__

Method Details

__init__(self, *args, **kwargs)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

retrieveData(self, serverURL, timeout)

source code 

returns headers and content when retrieving the resource at url.

Sets the headers and data attributes of the test instance.

pointNextToLocation(self, addToPath='')

source code 

arranges for the value of the location header to become the base URL of the next test.

addToPath, if given, is appended to the location header.

If no location header was provided, the test fails.

All this of course only works for tests in sequential regSuites.

assertHasStrings(self, *strings)

source code 

checks that all its arguments are found within content.

Decorators:
  • @utils.document

assertLacksStrings(self, *strings)

source code 

checks that all its arguments are *not* found within content.

Decorators:
  • @utils.document

assertHTTPStatus(self, expectedStatus)

source code 

checks whether the request came back with expectedStatus.

Decorators:
  • @utils.document

assertValidatesXSD(self)

source code 

checks whether the returned data are XSD valid.

This uses DaCHS built-in XSD validator with the built-in schema files; it hence will in general not retrieve schema files from external sources.

Decorators:
  • @utils.document

assertXpath(self, path, assertions)

source code 

checks an xpath assertion.

path is an xpath (as understood by lxml), with namespace prefixes statically mapped; there's currently v2 (VOTable 1.2), v1 (VOTable 1.1), v (whatever VOTable version is the current DaCHS default), h (the namespace of the XHTML elements DaCHS generates), and o (OAI-PMH 2.0). If you need more prefixes, hack the source and feed back your changes (monkeypatching self.XPATH_NAMESPACE_MAP is another option).

path must match exactly one element.

assertions is a dictionary mapping attribute names to their expected value. Use the key None to check the element content, and match for None if you expect an empty element.

If you need an RE match rather than equality, there's EqualingRE in your code's namespace.

Decorators:
  • @utils.document

getXpath(self, path, element=None)

source code 

returns the equivalent of tree.xpath(path) for an lxml etree of the current document or in element, if passed in.

This uses the same namespace conventions as assertXpath.

Decorators:
  • @utils.document

assertHeader(self, key, value)

source code 

checks that header key has value in the response headers.

keys are compared case-insensitively, values are compared literally.

Decorators:
  • @utils.document

getFirstVOTableRow(self)

source code 

interprets data as a VOTable and returns the first row as a dictionary

In test use, make sure the VOTable returned is sorted, or you will get randomly failing tests. Ideally, you'll constrain the results to just one match; database-querying cores (which is where order is an issue) also honor _DBOPTIONS_ORDER).

Decorators:
  • @utils.document

getVOTableRows(self)

source code 

parses the first table in a result VOTable and returns the contents as a sequence of dictionaries.

Decorators:
  • @utils.document

Class Variable Details

additionalNamesForProcs

Value:
{'EqualingRE': <class 'gavo.utils.codetricks.EqualingRE'>}

XPATH_NAMESPACE_MAP

Value:
{'h': 'http://www.w3.org/1999/xhtml',
 'o': 'http://www.openarchives.org/OAI/2.0/',
 'v': 'http://www.ivoa.net/xml/VOTable/v1.3',
 'v1': 'http://www.ivoa.net/xml/VOTable/v1.1',
 'v2': 'http://www.ivoa.net/xml/VOTable/v1.2'}

attrSeq

Value:
[<gavo.base.complexattrs.StructListAttribute object>,
 <gavo.base.attrdef.UnicodeAttribute object>,
 <gavo.base.attrdef.UnicodeAttribute object>,
 <gavo.base.attrdef.UnicodeAttribute object>,
 <gavo.base.parsecontext.IdAttribute object>,
 <gavo.base.attrdef.UnicodeAttribute object>,
 <gavo.base.parsecontext.OriginalAttribute object>,
 <gavo.base.parsecontext.ReferenceAttribute object>,
...

managedAttrs

Value:
{'bind': <gavo.base.complexattrs.StructListAttribute object>,
 'bindings': <gavo.base.complexattrs.StructListAttribute object>,
 'code': <gavo.base.attrdef.UnicodeAttribute object>,
 'deprecated': <gavo.base.attrdef.UnicodeAttribute object>,
 'doc': <gavo.base.attrdef.UnicodeAttribute object>,
 'id': <gavo.base.parsecontext.IdAttribute object>,
 'name': <gavo.base.attrdef.UnicodeAttribute object>,
 'original': <gavo.base.parsecontext.OriginalAttribute object>,
...

Property Details

description

Get Method:
unreachable.description(self)

rd

Get Method:
unreachable._getRD(self)