def test_push_front(self):
        p = nxpath()
        self.assertTrue(is_empty(p))
       
        p.push_front("data")
        self.assertEqual(len(p),1)
        self.assertEqual(p.__str__(),"data")

        p.push_front("mythen:NXdetector")
        self.assertEqual(len(p),2)
        self.assertEqual(p.__str__(),"mythen:NXdetector/data")
        
        p.push_front(name="",base_class="NXinstrument")
        self.assertEqual(len(p),3)
        self.assertEqual(p.__str__(),":NXinstrument/mythen:NXdetector/data")
        
        p.push_front(":NXentry")
        self.assertEqual(len(p),4)
        self.assertEqual(p.__str__(),":NXentry/:NXinstrument/mythen:NXdetector/data")

        p.push_front("/:NXroot")
        self.assertEqual(len(p),5)
        
        self.assertEqual(p.__str__(),"/:NXentry/:NXinstrument/mythen:NXdetector/data")
        self.assertTrue(is_root_element(p.front))
    def test_add_string(self):
        
        a = make_path(":NXentry")
        c = a+":NXinstrument/"
        self.assertEqual(c.__str__(),":NXentry/:NXinstrument")
        c = "/"+a
        self.assertEqual(c.__str__(),"/:NXentry")
        self.assertTrue(is_root_element(c.front))

        a += ":NXinstrument/data"
        self.assertEqual(a.__str__(),":NXentry/:NXinstrument/data")
    def test_pop_back(self):
        p = make_path(":NXentry/:NXinstrument/:NXdetector/data")

        self.assertTrue(not is_root_element(p.front))

        self.assertEqual(len(p),4)
        p.pop_back()
        self.assertEqual(p.__str__(),":NXentry/:NXinstrument/:NXdetector")
        p.pop_back()
        self.assertEqual(p.__str__(),":NXentry/:NXinstrument")
        p.pop_back()
        self.assertEqual(p.__str__(),":NXentry")
        p.pop_back()
        self.assertEqual(p.__str__(),"")
        self.assertRaises(IndexError,p.pop_back)