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

Rendering: append end of file with new line #21

Open
PatrickOHara opened this issue Oct 12, 2021 · 0 comments · May be fixed by #22
Open

Rendering: append end of file with new line #21

PatrickOHara opened this issue Oct 12, 2021 · 0 comments · May be fixed by #22

Comments

@PatrickOHara
Copy link

  • TSPLIB 95 version:
  • Python version:
  • Operating System:

Description

When rendering a problem, the EOF token is appended without a new line after this token. However in each problem file in the archive, EOF token is appended with a new line.

What I Did

Take this example adapted from test_problem:

from tsplib95 import fields as F
from tsplib95 import models as M

class TestProblem(M.Problem):
    foo = F.IntegerField('FOO')
    bar = F.StringField('BAR')

text = 'FOO: 42\nBAR: answer\nEOF\n'
assert TestProblem.parse(text).render() == text

The left hand side of the assert statement is 'FOO: 42\nBAR: answer\nEOF' (note the lack of \n at the end).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant