def test_visit(self): obj = Base(None, None) obj.called = Mock() obj.visit("called", "with", keyword="args") obj.called.assert_called_once_with("with", keyword="args")
def test_non_empty_visit(self): obj1 = Base(None, None) obj1.called = Mock() obj2 = Base(None, None) obj2.not_called = Mock() ListWrapper([obj1, obj2], None).visit("called", "with", keyword="args") obj1.called.assert_called_once_with("with", keyword="args") obj2.not_called.assert_not_called()
def test_visit(self): obj1 = Base(None, None) obj1.called = Mock() obj2 = Base(None, None) obj2.not_called = Mock() MapWrapper({"a": obj1, "b": obj2}, None).visit( "called", "with", keyword="args", ) obj1.called.assert_called_once_with("with", keyword="args") obj2.not_called.assert_not_called()