コード例 #1
0
ファイル: terminal.py プロジェクト: AndydeCleyre/ward
 def print_expect_chain_item(self, expect: Expected):
     checkbox = self.result_checkbox(expect)
     that_width = self.terminal_size.width - 32
     if expect.op == "satisfies" and hasattr(expect.that, "__name__"):
         expect_that = truncate(expect.that.__name__, num_chars=that_width)
     else:
         that = repr(expect.that) if expect.that else ""
         expect_that = truncate(that, num_chars=that_width)
     print(f"    {checkbox} it {expect.op} {expect_that}{Style.RESET_ALL}")
コード例 #2
0
def _(
    input=s, num_chars=each(20, 11, 10, 5), expected=each(s, s, "hello w...", "he...")
):
    result = truncate(input, num_chars)
    assert result == expected
コード例 #3
0
def _(input=s,
      num_chars=each(20, 11, 10, 5),
      expected=each(s, s, "hello w...", "he...")):
    result = truncate(input, num_chars)
    expect(result).equals(expected)