Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.handle() w/ new text yields previous results if AssertionError is raised #400

Open
Antsthebul opened this issue Jun 21, 2023 · 0 comments

Comments

@Antsthebul
Copy link

Antsthebul commented Jun 21, 2023

When using the same HTML2Text instance, the failure is presisted through future valid strings. Items that it tries to prepend the old text to the new text

  • Version by html2text --version 2020.1.16
  • Test script
  • Python version python --version 3.10.11

Failing

test = "Hellow<![]-->world"
test2="Goodbye"

h = HTML2Text()

try:
    print(h.handle(test))
except AssertionError:
    h.handle(test2)

ouput

[...]    raise AssertionError(
AssertionError: expected name token at "<![]-->worldGoodbye"

Working

test = "Hellow<![]-->world"
test2="Goodbye"

h = HTML2Text()
try:
    print(h.handle(test))
except AssertionError:
    print("pass")

output

pass
@Antsthebul Antsthebul changed the title Calling handle on new text yields previous results if Assertion is Raised `.handle() w/ new text yields previous results if AssertionError is raised Jun 21, 2023
@Antsthebul Antsthebul changed the title `.handle() w/ new text yields previous results if AssertionError is raised .handle() w/ new text yields previous results if AssertionError is raised Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant