import unittest from util.names import escape_tag class TestEscapeTag(unittest.TestCase): def assertTag(self, input_tag, expected): self.assertEquals(expected, escape_tag(input_tag)) def test_basic_tag(self): self.assertTag('latest', 'latest') self.assertTag('latest124', 'latest124') self.assertTag('5de1e98d', '5de1e98d') def test_invalid_tag(self): self.assertTag('detailed_view#61', 'detailed_view_61') self.assertTag('-detailed_view#61', '_detailed_view_61') if __name__ == '__main__': unittest.main()