| 115 | assert out.level == 'unknown' |
| 116 | |
| 117 | def test_outputbuffer_level(self, output_spy): |
| 118 | out = self.OutputBuffer() |
| 119 | # visible: all |
| 120 | out.level = 'info' |
| 121 | output_spy.begin() |
| 122 | out.info('info color') |
| 123 | out.head('head color') |
| 124 | out.good('good color') |
| 125 | out.warn('warn color') |
| 126 | out.fail('fail color') |
| 127 | out.write() |
| 128 | assert len(output_spy.flush()) == 5 |
| 129 | # visible: head, warn, fail |
| 130 | out.level = 'warn' |
| 131 | output_spy.begin() |
| 132 | out.info('info color') |
| 133 | out.head('head color') |
| 134 | out.good('good color') |
| 135 | out.warn('warn color') |
| 136 | out.fail('fail color') |
| 137 | out.write() |
| 138 | assert len(output_spy.flush()) == 3 |
| 139 | # visible: head, fail |
| 140 | out.level = 'fail' |
| 141 | output_spy.begin() |
| 142 | out.info('info color') |
| 143 | out.head('head color') |
| 144 | out.good('good color') |
| 145 | out.warn('warn color') |
| 146 | out.fail('fail color') |
| 147 | out.write() |
| 148 | assert len(output_spy.flush()) == 2 |
| 149 | # visible: head |
| 150 | out.level = 'invalid level' |
| 151 | output_spy.begin() |
| 152 | out.info('info color') |
| 153 | out.head('head color') |
| 154 | out.good('good color') |
| 155 | out.warn('warn color') |
| 156 | out.fail('fail color') |
| 157 | out.write() |
| 158 | assert len(output_spy.flush()) == 1 |
| 159 | |
| 160 | def test_outputbuffer_batch(self, output_spy): |
| 161 | out = self.OutputBuffer() |