Changeset 3118 for exist


Ignore:
Timestamp:
06/12/07 10:07:05 (12 years ago)
Author:
lawrence
Message:

Splitting out the (authoratative?) python xqueries into named
files within the new egg for exist (and other ndg utilities)

Location:
exist/trunk
Files:
14 added
2 edited

Legend:

Unmodified
Added
Removed
  • exist/trunk/python/ndgeXist/ndgXqueries.py

    r3111 r3118  
    11import pkg_resources 
     2import re 
    23class ndgXqueries(object): 
    34    ''' Holds a set of ndg xqueries after having read them from disk (which is 
     
    1920    def keys(self): 
    2021        return self.xq.keys() 
     22    def help(self,key): 
     23        ''' Return the comment string at the top of the xquery (if it exists) ''' 
     24        xq=self.xq[key] 
     25        s=xq.find('(:') 
     26        e=xq.find(':)') 
     27        if s!=-1 and e>s:  
     28            return xq[s+2:e] 
     29        else: return 'No help available for [%s]'%key 
  • exist/trunk/python/ndgeXist/test_ndgXqueries.py

    r3110 r3118  
    33class TestCase(unittest.TestCase): 
    44     
     5    def setUp(self): 
     6        self.ndgx=ndgXqueries.ndgXqueries() 
    57    def test_xqueryLoad(self): 
    6         ndgx=ndgXqueries.ndgXqueries() 
    7         print ndgx.keys() 
     8        print self.ndgx.keys() 
     9    def test_xqueryHelp(self): 
     10        ''' Testing that the help string in xqueries is returned correctly ''' 
     11        h=self.ndgx.help('csml') 
     12        r=' Return a specific csml document when TargetCollection and LocalID are overwritten ' 
     13        self.assertEqual(h,r) 
    814         
    915if __name__=="__main__": 
Note: See TracChangeset for help on using the changeset viewer.