def testSplitLeaf(self): r = Route('bla/foo/<id>/pluto/leaf') p,l = r.split() self.assertFalse(p.is_leaf) self.assertTrue(l.is_leaf) self.assertEqual(p.path,'/bla/foo/<id>/pluto/') self.assertEqual(l.path,'/leaf')
def testSplitLeaf(self): r = Route('bla/foo/<id>/pluto/leaf') p, l = r.split() self.assertFalse(p.is_leaf) self.assertTrue(l.is_leaf) self.assertEqual(p.path, '/bla/foo/<id>/pluto/') self.assertEqual(l.path, '/leaf')
def testSplitDir(self): r = Route('bla/foo/<id>/pluto/') self.assertEqual(r.level,4) p,l = r.split() self.assertFalse(p.is_leaf) self.assertFalse(l.is_leaf) self.assertEqual(p.path,'/bla/foo/<id>/') self.assertEqual(l.path,'/pluto/')
def testSplitDir(self): r = Route('bla/foo/<id>/pluto/') self.assertEqual(r.level, 4) p, l = r.split() self.assertFalse(p.is_leaf) self.assertFalse(l.is_leaf) self.assertEqual(p.path, '/bla/foo/<id>/') self.assertEqual(l.path, '/pluto/')
def testSplitRoot(self): r = Route('') self.assertEqual(r.level,0) p,l = r.split() self.assertFalse(p.is_leaf) self.assertEqual(p.path,'/') self.assertEqual(l,None) r = Route('bla') p,l = r.split() self.assertFalse(p.is_leaf) self.assertTrue(l.is_leaf) self.assertEqual(p.path,'/') self.assertEqual(l.path,'/bla') r = Route('bla/') p,l = r.split() self.assertFalse(p.is_leaf) self.assertFalse(l.is_leaf) self.assertEqual(p.path,'/') self.assertEqual(l.path,'/bla/')
def testSplitRoot(self): r = Route('') self.assertEqual(r.level, 0) p, l = r.split() self.assertFalse(p.is_leaf) self.assertEqual(p.path, '/') self.assertEqual(l, None) r = Route('bla') p, l = r.split() self.assertFalse(p.is_leaf) self.assertTrue(l.is_leaf) self.assertEqual(p.path, '/') self.assertEqual(l.path, '/bla') r = Route('bla/') p, l = r.split() self.assertFalse(p.is_leaf) self.assertFalse(l.is_leaf) self.assertEqual(p.path, '/') self.assertEqual(l.path, '/bla/')