-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Misc improvements to display=plain (#1166)
- Handle multiple models and multiple tasks (display task/model to disambiguate if required) - Pad display so columns always line up - Throttle updates to once every second - Condense task panel when there is no body or footer - Call rich_initialise in PlainDisplay constructor so ansi colors, etc. are disabled globally for rich printing. - Remove spurious plain print from rich display (since plain now has its own display handler)
- Loading branch information
Showing
6 changed files
with
89 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from inspect_ai._util.text import truncate | ||
|
||
|
||
def test_basic_truncation(): | ||
assert truncate("Hello World!", 8) == "Hello..." | ||
assert truncate("Short", 8) == "Short " | ||
|
||
|
||
def test_custom_overflow(): | ||
assert truncate("Hello World!", 8, overflow=">>") == "Hello >>" | ||
assert truncate("Testing", 5, overflow="~") == "Test~" | ||
|
||
|
||
def test_no_padding(): | ||
assert truncate("Hi", 8, pad=False) == "Hi" | ||
assert truncate("Hello World!", 8, pad=False) == "Hello..." | ||
|
||
|
||
def test_exact_length(): | ||
assert truncate("12345678", 8) == "12345678" | ||
assert truncate("1234", 4, pad=False) == "1234" |