def interface(self): return Message.to_python( dict( message='Hello there %s!', params=('world', ), formatted='Hello there world!', ))
def test_get_hash_uses_formatted(self): interface = Message.to_python(dict( message=None, params=(), formatted='Hello there world!' )) assert interface.get_hash() == [interface.formatted]
def test_compute_hashes_uses_formatted(self): interface = Message.to_python(dict( message=None, params=(), formatted='Hello there world!' )) assert interface.compute_hashes() == [[interface.formatted]]
def interface(self): return Message.to_python( dict( message='Hello there %s!', params=('world', ), formatted='Hello there world!', ) )
def test_format_braces(self): interface = Message.to_python(dict( message='Hello there {}!', params=('world', ), )) assert interface.to_json() == { 'message': interface.message, 'params': interface.params, 'formatted': 'Hello there world!' }
def test_format_kwargs(self): interface = Message.to_python(dict( message='Hello there %(name)s!', params={'name': 'world'}, )) assert interface.to_json() == { 'message': interface.message, 'params': interface.params, 'formatted': 'Hello there world!' }
def test_grouping_component_uses_formatted(self): interface = Message.to_python( dict(message=None, params=(), formatted='Hello there world!')) assert interface.get_grouping_component().as_dict() == { 'hint': None, 'id': 'message', 'name': 'message', 'contributes': True, 'values': ['Hello there world!'], }
def test_stringify_primitives(self): assert Message.to_python({'formatted': 42}).formatted == '42' assert Message.to_python({'formatted': True}).formatted == 'true' assert Message.to_python({'formatted': 4.2}).formatted == '4.2'
def test_get_hash_uses_formatted(self): interface = Message.to_python( dict(message=None, params=(), formatted='Hello there world!')) assert interface.get_hash() == [interface.formatted]