fix KeyError
[sfa.git] / tests / testMisc.py
1 import unittest
2 from sfa.util.misc import *
3
4 class TestMisc(unittest.TestCase):
5    def setUp(self):
6       pass
7
8    def testGetLeft(self):
9       self.assertEqual(get_leaf("foo"), "foo")
10       self.assertEqual(get_leaf("foo.bar"), "bar")
11
12    def testGetAuthority(self):
13       self.assertEqual(get_authority("foo"), "")
14       self.assertEqual(get_authority("foo.bar"), "foo")
15       self.assertEqual(get_authority("foo.bar.x"), "foo.bar")
16
17 if __name__ == "__main__":
18     unittest.main()