@pytest.mark.django_db
def test_format_registry_reregister(no_formats):
 registry = FormatRegistry()
 filetype = registry.register('foo', 'foo')
 new_filetype = registry.register('foo', 'foo')
 assert (new_filetype == filetype)
 _test_formats(registry, ['foo'])
 new_filetype = registry.register('foo', 'foo', title='Bar')
 assert (new_filetype == filetype)
 assert (new_filetype.title == 'Bar')
 _test_formats(registry, ['foo'])
 new_filetype = registry.register('foo', 'bar')
 assert (new_filetype == filetype)
 assert (new_filetype.title == 'Bar')
 assert (str(new_filetype.extension) == 'bar')
 _test_formats(registry, ['foo'])

@ pytest . mark . django_db def test_format_registry_reregister ( no_formats ) : registry = FormatRegistry ( ) filetype = registry . register ( 'foo' , 'foo' ) new_filetype = registry . register ( 'foo' , 'foo' ) assert ( new_filetype == filetype ) _test_formats ( registry , [ 'foo' ] ) new_filetype = registry . register ( 'foo' , 'foo' , title = 'Bar' ) assert ( new_filetype == filetype ) assert ( new_filetype . title == 'Bar' ) _test_formats ( registry , [ 'foo' ] ) new_filetype = registry . register ( 'foo' , 'bar' ) assert ( new_filetype == filetype ) assert ( new_filetype . title == 'Bar' ) assert ( str ( new_filetype . extension ) == 'bar' ) _test_formats ( registry , [ 'foo' ] )
tests the creation of a file extension .