def test_getPayload_empty(inv_reader_nolog: sphinx.SphinxInventory) -> None: """ Return empty string. """ content = b"""# Sphinx inventory version 2 # Project: some-name # Version: 2.0 # The rest of this file is compressed with zlib. x\x9c\x03\x00\x00\x00\x00\x01""" result = inv_reader_nolog._getPayload('http://base.ignore', content) assert '' == result
def test_getPayload_content(inv_reader_nolog: sphinx.SphinxInventory) -> None: """ Return content as string. """ payload = "first_line\nsecond line\nit's a snake: \U0001F40D" content = b"""# Ignored line # Project: some-name # Version: 2.0 # commented line. """ + zlib.compress(payload.encode('utf-8')) result = inv_reader_nolog._getPayload('http://base.ignore', content) assert payload == result