Ignore:
Timestamp:
01/24/13 15:07:56 (15 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Check the sink channel cardinality and link duplication when adding a new link.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/scheme/tests/test_scheme.py

    r11210 r11275  
    66from ...registry.tests import small_testing_registry 
    77 
    8 from .. import Scheme, SchemeNode, SchemeLink, \ 
    9                SchemeTextAnnotation, SchemeArrowAnnotation, \ 
    10                SchemeTopologyError, IncompatibleChannelTypeError 
     8from .. import ( 
     9    Scheme, SchemeNode, SchemeLink, SchemeTextAnnotation, 
     10    SchemeArrowAnnotation, SchemeTopologyError, SinkChannelError, 
     11    DuplicatedLinkError, IncompatibleChannelTypeError 
     12) 
    1113 
    1214 
     
    2325        self.assertEqual(scheme.title, "") 
    2426        self.assertEqual(scheme.description, "") 
    25         self.assertEqual(scheme.path, "") 
    2627 
    2728        nodes_added = [] 
     
    8788                          w2, "Data", w1, "Data") 
    8889 
     90        # add back l2 for the folowing checks 
     91        scheme.add_link(l2) 
     92 
     93        # Add a duplicate link 
     94        self.assertRaises(DuplicatedLinkError, scheme.new_link, 
     95                          w1, "Data", w3, "Data") 
     96 
     97        # Add a link to an already connected sink channel 
     98        self.assertRaises(SinkChannelError, scheme.new_link, 
     99                          w2, "Data", w3, "Data") 
     100 
    89101        text_annot = SchemeTextAnnotation((0, 0, 100, 20), "Text") 
    90102        scheme.add_annotation(text_annot) 
Note: See TracChangeset for help on using the changeset viewer.