MCPcopy
hub / github.com/python-attrs/attrs / test_str_no_repr

Method test_str_no_repr

tests/test_dunders.py:435–444  ·  view source on GitHub ↗

Raises a ValueError if repr=False and str=True.

(self)

Source from the content-addressed store, hash-verified

433 assert (str(e) == repr(e)) is add_str
434
435 def test_str_no_repr(self):
436 """
437 Raises a ValueError if repr=False and str=True.
438 """
439 with pytest.raises(ValueError) as e:
440 simple_class(repr=False, str=True)
441
442 assert (
443 "__str__ can only be generated if a __repr__ exists."
444 ) == e.value.args[0]
445
446
447# these are for use in TestAddHash.test_cache_hash_serialization

Callers

nothing calls this directly

Calls 1

simple_classFunction · 0.85

Tested by

no test coverage detected