From 9c2e747528766efdabcd48a7651d8e5206217d11 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Sat, 4 Jun 2016 12:37:56 -0500 Subject: [PATCH] Add tests around BaseFormatter#after_init --- tests/unit/test_base_formatter.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/unit/test_base_formatter.py b/tests/unit/test_base_formatter.py index 625e4c1..879ca35 100644 --- a/tests/unit/test_base_formatter.py +++ b/tests/unit/test_base_formatter.py @@ -101,3 +101,17 @@ def test_write_uses_print(print_function): mock.call(line), mock.call(source), ] + + +class AfterInitFormatter(base.BaseFormatter): + """Subclass for testing after_init.""" + + def after_init(self): + """Define method to verify operation.""" + self.post_initialized = True + + +def test_after_init_is_always_called(): + """Verify after_init is called.""" + formatter = AfterInitFormatter() + assert getattr(formatter, 'post_initialized') is True