From 32e5d633f43ca81dc94ce4f4d6be2a5b59926e23 Mon Sep 17 00:00:00 2001 From: tobi-wan-kenobi Date: Tue, 7 Apr 2020 20:59:26 +0200 Subject: [PATCH] [core/output] Add tests for pango formatting --- core/output.py | 2 +- tests/core/test_output.py | 51 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/core/output.py b/core/output.py index 4b19260..436c4af 100644 --- a/core/output.py +++ b/core/output.py @@ -52,7 +52,7 @@ class block(object): text = attr.get('full_text', '') if 'full_text' in attr: del attr['full_text'] - result = 'test', + self.someBlock.pangoize({ 'pango': { 'attr': 'blub', 'x': 'y', 'full_text': 'test' } }) + ) + self.assertEqual('pango', self.someBlock.dict()['markup']) + + def test_padding(self): + self.someBlock.set('padding', '***') + self.someBlock.set('full_text', 'test') + + self.assertEqual('***test***', self.someBlock.dict()['full_text']) + + def test_pre_suffix(self): + self.someBlock.set('padding', '*') + self.someBlock.set('prefix', 'pre') + self.someBlock.set('suffix', 'suf') + self.someBlock.set('full_text', 'test') + + self.assertEqual('*pre*test*suf*', self.someBlock.dict()['full_text']) + # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4