Skip to content

Rendering: append end of file with new line #21

@PatrickOHara

Description

@PatrickOHara
  • 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions