Changeset 1246

Show
Ignore:
Timestamp:
04/03/08 23:08:00 (8 months ago)
Author:
sgillies
Message:

Pass entity loading tests

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • PleiadesEntity/trunk/tests/LoadEntity.txt

    r1225 r1246  
    4040--------------- 
    4141 
     42    >>> TEST_DATA = self.test_params.TEST_DATA 
     43    >>> BA_ID_MAX = self.test_params.BA_ID_MAX 
     44    >>> from Products.PleiadesEntity.Extensions.loader import load_place 
    4245    >>> r = load_place(folder, "%s/batlas-65-2-24-frank.xml" % TEST_DATA) 
    4346    >>> pid = r['place_id'] 
     
    112115    >>> len(tps) 
    113116    2 
    114     >>> tps[0].Title 
     117    >>> tps0 = tps[0].getObject() 
     118    >>> tps0.Title() 
    115119    'Attested: Roman (30 BC - AD 300)' 
    116     >>> tps[0].getId 
     120    >>> tps0.getId() 
    117121    'roman' 
    118     >>> tps[0].getAttestationConfidence 
    119     'confident' 
    120     >>> tps[1].Title 
     122    >>> tps0.getAttestationConfidence() 
     123    'confident' 
     124    >>> tps1 = tps[1].getObject() 
     125    >>> tps1.Title() 
    121126    'Attested: Late Antique (AD 300 - 625)' 
    122     >>> tps[1].getId 
     127    >>> tps1.getId() 
    123128    'late-antique' 
    124     >>> tps[1].getAttestationConfidence 
     129    >>> tps1.getAttestationConfidence() 
    125130    'confident' 
    126131     
     
    152157    >>> len(tps) 
    153158    1 
    154     >>> tps[0].Title 
     159    >>> tps0 = tps[0].getObject() 
     160    >>> tps0.Title() 
    155161    'Attested: Classical (550 - 330 BC)' 
    156     >>> tps[0].getId 
     162    >>> tps0.getId() 
    157163    'classical' 
    158     >>> tps[0].getAttestationConfidence 
     164    >>> tps0.getAttestationConfidence() 
    159165    'confident' 
    160166    >>> srs = n1.getFolderContents({'meta_type':['SecondaryReference']}) 
     
    192198    >>> len(tps) 
    193199    3 
    194     >>> tps[0].Title 
     200    >>> tps0 = tps[0].getObject() 
     201    >>> tps0.Title() 
    195202    'Attested: Classical (550 - 330 BC)' 
    196     >>> tps[0].getId 
     203    >>> tps0.getId() 
    197204    'classical' 
    198     >>> tps[0].getAttestationConfidence 
    199     'confident' 
    200     >>> tps[1].Title 
     205    >>> tps0.getAttestationConfidence() 
     206    'confident' 
     207    >>> tps1 = tps[1].getObject() 
     208    >>> tps1.Title() 
    201209    'Attested: Roman (30 BC - AD 300)' 
    202     >>> tps[1].getId 
     210    >>> tps1.getId() 
    203211    'roman' 
    204     >>> tps[1].getAttestationConfidence 
    205     'confident' 
    206     >>> tps[2].Title 
     212    >>> tps1.getAttestationConfidence() 
     213    'confident' 
     214    >>> tps2 = tps[2].getObject() 
     215    >>> tps2.Title() 
    207216    'Attested: Late Antique (AD 300 - 625)' 
    208     >>> tps[2].getId 
     217    >>> tps2.getId() 
    209218    'late-antique' 
    210     >>> tps[2].getAttestationConfidence 
     219    >>> tps2.getAttestationConfidence() 
    211220    'confident' 
    212221    >>> l.getTimePeriods() 
     
    251260    'RE Ninoe' 
    252261     
    253 Test the geo adapters 
    254 --------------------- 
    255  
    256     >>> from Products.PleiadesGeocoder.interfaces import IGeoItemSimple, IGeoCollectionSimple 
    257  
    258     >>> g = IGeoItemSimple(p) 
    259     >>> g.isGeoreferenced() 
    260     True 
    261     >>> g.geom_type 
    262     'Point' 
    263     >>> g.coords 
    264     (28.728899999999999, 37.714500000000001, 0.0) 
    265     >>> gi = g.__geo_interface__ 
    266     >>> gi['type'] 
    267     'Feature' 
    268     >>> gi['properties']['title'] 
    269     'Aphrodisias/Ninoe' 
    270     >>> gi['properties']['description'] 
    271     'An ancient settlement, attested during the Classical, Roman and Late Antique periods (modern location: Geyre). It was known in antiquity by the names: Aphrodisias and Ninoe.' 
    272  
    273     >>> c = IGeoCollectionSimple(folder.places) 
    274     >>> len(list(c.geoItems())) 
    275     1 
    276  
    277262Load one nameless entity 
    278263------------------------ 
     
    300285    'certain' 
    301286 
    302     >>> g = IGeoItemSimple(p) 
    303     >>> g.isGeoreferenced() 
    304     True 
    305287 
    306288Reload that entity 
     
    340322    'certain' 
    341323 
    342     >>> g = IGeoItemSimple(p) 
    343     >>> g.isGeoreferenced() 
    344     False 
    345  
  • PleiadesEntity/trunk/tests/test_docfiles.py

    r1244 r1246  
    33import glob 
    44import unittest 
    5 from zope.testing import doctest 
    6 from zope.component import testing 
    7 from Testing import ZopeTestCase as ztc 
     5import doctest 
    86from Testing import ZopeTestCase as ztc 
    97from Products.PloneTestCase import PloneTestCase as ptc 
    108from Products.PloneTestCase.layer import onsetup, PloneSite 
     9import _testing 
    1110 
    12 import _testing 
    13 from _testing import * 
    14  
    15 ptc.setupPloneSite(products=['Archetypes', 'ATVocabularyManager', 'Geographer', 'PleiadesEntity']) 
    1611ptc.installProduct('Geographer') 
    1712ptc.installProduct('ATVocabularyManager') 
    1813ptc.installProduct('PleiadesEntity') 
    19 #ptc.setupPloneSite(products=['Archetypes', 'ATVocabularyManager', 'Geographer', 'PleiadesEntity']) 
     14ptc.setupPloneSite(products=['Archetypes', 'ATVocabularyManager', 'Geographer', 'PleiadesEntity']) 
    2015 
    2116#REQUIRE_TESTBROWSER = ['PublishGeoEntity.txt'] 
    2217 
    23 optionflags = doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE 
     18optionflags = doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_ONLY_FIRST_FAILURE 
    2419 
    2520class PleiadesEntityTestCase(ptc.PloneTestCase): 
    26     pass 
    27      
     21 
     22    def afterSetUp(self): 
     23        self.test_params = _testing 
     24 
    2825 
    2926def test_suite(): 
     
    3128        ztc.ZopeDocFileSuite( 
    3229            'Entities.txt', 
     30            package='Products.PleiadesEntity.tests', 
     31            test_class=PleiadesEntityTestCase, 
     32            optionflags=optionflags, 
     33            ), 
     34        ztc.ZopeDocFileSuite( 
     35            'LoadEntity.txt', 
    3336            package='Products.PleiadesEntity.tests', 
    3437            test_class=PleiadesEntityTestCase,