def test_BoundaryTracker_get_regions_for_nodes(self):
        bounds = BoundaryTracker()
        regionA = "A"
        regionB = "B"

        bounds.add(Span(1, 4), regionA, regionB)
        self.assertEqual(['A', 'B'], bounds.get_regions_for_nodes(2, 1))
        with self.assertRaisesRegexp(
                Exception,
                "BoundaryTracker: No boundary found containing nodes: 7, 8"):
            bounds.get_regions_for_nodes(7, 8)
    def test_Boudnaries_update_regions(self):
        bounds = BoundaryTracker()
        region_factory = RegionFactory()

        outside = region_factory.get_next_region_id()
        bounds.add(Span(1, 8), outside, outside)  # Initially all nodes outside

        # Add chord (1,4)
        regionA = region_factory.get_next_region_id()
        bounds.add(Span(1, 4), outside, regionA)

        # Change boundary on span (2,3) from out_A to out_B
        regionB = region_factory.get_next_region_id()
        bounds.update_regions(Span(2, 3), regionA, regionB)
        self.assertEqual([outside, regionB],
                         bounds.get_regions_for_nodes(2, 3))