Exemplo n.º 1
0
 def __rich_measure__(self, console: "Console",
                      options: "ConsoleOptions") -> "Measurement":
     _, right, _, left = Padding.unpack(self.padding)
     if self.code_width is not None:
         width = self.code_width + self._numbers_column_width + right + left
         return Measurement(self._numbers_column_width, width)
     return Measurement(self._numbers_column_width, options.max_width)
Exemplo n.º 2
0
def test_unpack():
    assert Padding.unpack(3) == (3, 3, 3, 3)
    assert Padding.unpack((3, )) == (3, 3, 3, 3)
    assert Padding.unpack((3, 4)) == (3, 4, 3, 4)
    assert Padding.unpack((3, 4, 5, 6)) == (3, 4, 5, 6)
    with pytest.raises(ValueError):
        Padding.unpack((1, 2, 3))