()
| 395 | |
| 396 | |
| 397 | def test_print_method_weird(): |
| 398 | class TextMagicHat(object): |
| 399 | def __getattr__(self, key): |
| 400 | return key |
| 401 | |
| 402 | f = HTMLFormatter() |
| 403 | |
| 404 | text_hat = TextMagicHat() |
| 405 | assert text_hat._repr_html_ == "_repr_html_" |
| 406 | with capture_output() as captured: |
| 407 | result = f(text_hat) |
| 408 | |
| 409 | assert result is None |
| 410 | assert "FormatterWarning" not in captured.stderr |
| 411 | |
| 412 | class CallableMagicHat(object): |
| 413 | def __getattr__(self, key): |
| 414 | return lambda: key |
| 415 | |
| 416 | call_hat = CallableMagicHat() |
| 417 | with capture_output() as captured: |
| 418 | result = f(call_hat) |
| 419 | |
| 420 | assert result is None |
| 421 | |
| 422 | class BadReprArgs(object): |
| 423 | def _repr_html_(self, extra, args): |
| 424 | return "html" |
| 425 | |
| 426 | bad = BadReprArgs() |
| 427 | with capture_output() as captured: |
| 428 | result = f(bad) |
| 429 | |
| 430 | assert result is None |
| 431 | assert "FormatterWarning" not in captured.stderr |
| 432 | |
| 433 | |
| 434 | def test_format_config(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…