def test_get(self): trie = NsTrie(('com.example.foo', 'com.example.bar')) expected = NsNode([ ('foo', String('com.example.foo')), ('bar', String('com.example.bar')) ]) self.assertEqual(expected, trie.get('com.example')) self.assertEqual(expected, trie['com.example']) with self.assertRaises(KeyError): trie.get('org.example.foo')