def test_3(self): """Test tool clashes in a suite.""" c_foo = ResolvedContext(["foo"]) c_bah = ResolvedContext(["bah"]) s = Suite() s.add_context("foo", c_foo) s.add_context("bah", c_bah) s.add_context("bah2", c_bah) expected_tools = set(["fooer", "bahbah", "blacksheep"]) self.assertEqual(set(s.get_tools().keys()), expected_tools) self.assertEqual(s.get_tool_context("bahbah"), "bah2") self.assertEqual(s.get_tool_context("blacksheep"), "bah2") s.bump_context("bah") self.assertEqual(s.get_tool_context("bahbah"), "bah") self.assertEqual(s.get_tool_context("blacksheep"), "bah") expected_conflicts = set(["bahbah", "blacksheep"]) self.assertEqual(set(s.get_conflicting_aliases()), expected_conflicts) s.set_context_prefix("bah", "hey_") expected_tools = set( ["fooer", "bahbah", "blacksheep", "hey_bahbah", "hey_blacksheep"]) self.assertEqual(set(s.get_tools().keys()), expected_tools) s.remove_context_prefix("bah") expected_tools = set(["fooer", "bahbah", "blacksheep"]) self.assertEqual(set(s.get_tools().keys()), expected_tools) self.assertEqual(s.get_tool_context("bahbah"), "bah") self.assertEqual(s.get_tool_context("blacksheep"), "bah") s.hide_tool("bah", "bahbah") self.assertEqual(s.get_tool_context("bahbah"), "bah2") s.unhide_tool("bah", "bahbah") self.assertEqual(s.get_tool_context("bahbah"), "bah") self._test_serialization(s)
def test_3(self): """Test tool clashes in a suite.""" c_foo = ResolvedContext(["foo"]) c_bah = ResolvedContext(["bah"]) s = Suite() s.add_context("foo", c_foo) s.add_context("bah", c_bah) s.add_context("bah2", c_bah) expected_tools = set(["fooer", "bahbah", "blacksheep"]) self.assertEqual(set(s.get_tools().keys()), expected_tools) self.assertEqual(s.get_tool_context("bahbah"), "bah2") self.assertEqual(s.get_tool_context("blacksheep"), "bah2") s.bump_context("bah") self.assertEqual(s.get_tool_context("bahbah"), "bah") self.assertEqual(s.get_tool_context("blacksheep"), "bah") expected_conflicts = set(["bahbah", "blacksheep"]) self.assertEqual(set(s.get_conflicting_aliases()), expected_conflicts) s.set_context_prefix("bah", "hey_") expected_tools = set(["fooer", "bahbah", "blacksheep", "hey_bahbah", "hey_blacksheep"]) self.assertEqual(set(s.get_tools().keys()), expected_tools) s.remove_context_prefix("bah") expected_tools = set(["fooer", "bahbah", "blacksheep"]) self.assertEqual(set(s.get_tools().keys()), expected_tools) self.assertEqual(s.get_tool_context("bahbah"), "bah") self.assertEqual(s.get_tool_context("blacksheep"), "bah") s.hide_tool("bah", "bahbah") self.assertEqual(s.get_tool_context("bahbah"), "bah2") s.unhide_tool("bah", "bahbah") self.assertEqual(s.get_tool_context("bahbah"), "bah") self._test_serialization(s)