frank: thuban/test test_load.py,1.41,1.42

Frank Koormann frank.koormann at intevation.de
Thu Dec 16 12:51:32 CET 2004


* Bernhard Herzog <bh at intevation.de> [041216 12:13]:
> > +    def checkSession(self, session):
> > +        """Check if session has been loaded successfully."""
> 
> I'm not sure this really is better than before.  All you check are
> titles and the number of layers, but both aspects are not affected by
> the filenames.  

What else should I check? The point is, the session defined for the test
is broken, the path to roads_line.shp is wrong. The current
approach is "all or nothing", i.e. you can't cancel loading for a
missing shapefile but load all others. The existance of a session
with three layers is the pointer that the loading has been successfully.
And it couldn't be successfully without interpreting the callbacks
correct:

What I test is open_shapefile():

test_01_single_path_error_fix:
- the SessionLoader.open_shapefile should recognizes the missing roads_line.shp 
- the callback is called with mode "search" and returns
  ("../Data/iceland/roads-line.shp",0), i.e. the path has been entered
  interactively (0 means "not from list of known paths)
- SessionLoader.open_shapefile should try again and succeed
- proceed without further user interaction.
--> The seesion with three layers exists.

test_02_path_error_fix_from_list:
- the SessionLoader.open_shapefile should recognizes the missing roads_line.shp
- the callback is called with mode "search" and returns
  ("../Data/iceland/roads-line.shp",1), i.e. the path has been taken
  from list of known path.
- SessionLoader.open_shapefile should try again and succeed
- since taken from a list, interact with the user (call callback with
  mode "check")
- callback returns
  (os.path.abspath("../Data/iceland/roads-line.shp"),1),
  i.e. the user accepts the suggested alternative.
- SessionLoader.open_shapefile should proceed
--> The seesion with three layers exists.

[...]

What could be added is something like already implemented in
test_06_path_error_fix_from_list_fails
to ensure that all reactions defined for the callback actually have been 
used:
        self.assertRaises(IndexError, s_cb.s_cb, None, "search")
        self.assertRaises(IndexError, s_cb.s_cb, None, "check")
--> pop on an empty list should cause an IndexError

> 
> Plus, you do this test as the only actual check in three test cases.
> That looks fishy to me.  Those three test cases use callbacks that do
> differ in what they return.  Doesn't that lead to some observable
> differences in behavior that you can test for?

No, as explained above.

Frank

-- 
Frank Koormann                             <frank.koormann at intevation.de>
 Professional Service around Free Software       (http://intevation.net/)
 FreeGIS Project                                 (http://freegis.org/)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20041216/0992abae/attachment.bin


More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)