Esempio n. 1
0
    def test_centered_output(self, _):
        """Test how the `output` method handle centering operations"""
        output = Output()

        # Let's manually set the distribution for the test case...
        output.distribution = Distributions.DEBIAN

        # # ODD ENTRIES NUMBER # #
        output.results = ['1', '2', '3']
        # Let's run the algorithm !
        output.output()
        self.assertListEqual(output.results, [
            '', '', '', '', '', '', '', '1', '2', '3', '', '', '', '', '', '',
            '', ''
        ])

        # # EVEN ENTRIES NUMBER # #
        output.results = ['1', '2', '3', '4']
        output.output()
        self.assertListEqual(output.results, [
            '', '', '', '', '', '', '', '1', '2', '3', '4', '', '', '', '', '',
            '', ''
        ])

        # # FULL ENTRIES # #
        output.results = [
            '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12',
            '13', '14', '15', '16', '17', '18'
        ]
        output.output()
        self.assertListEqual(output.results, [
            '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12',
            '13', '14', '15', '16', '17', '18'
        ])

        # # NO ENTRY # #
        output.results = []
        output.output()
        self.assertListEqual(output.results, [
            '',
            '',
            '',
            '',
            '',
            '',
            '',
            '',
            '',
            '',
            '',
            '',
            '',
            '',
            '',
            '',
            '',
            '',
        ])
Esempio n. 2
0
    def test_append(self):
        """Test the `append` method, for new entries"""
        output = Output()

        # Let's manually set the distribution for the test case...
        output.distribution = Distributions.DEBIAN

        output.append('KEY', 'VALUE')

        self.assertEqual(output.results, ['COLOR_1KEY:CLEAR VALUE'])