Skip to content
Snippets Groups Projects
Commit 6a918081 authored by Robert Forkel's avatar Robert Forkel
Browse files

release 1.8.1

parent 6086c64b
Branches
Tags v1.8.1
No related merge requests found
......@@ -2,7 +2,9 @@
The `newick` package adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [v1.8.1] - 2023-03-05
Bugfix: Make `unquoted_name` property work for nodes without names, too.
## [v1.8.0] - 2023-03-05
......
[metadata]
name = newick
version = 1.8.1.dev0
version = 1.8.1
author = Robert Forkel
author_email = robert_forkel@eva.mpg.de
description = A python module to read and write the Newick format
......
......@@ -10,7 +10,7 @@ import pathlib
import itertools
import dataclasses
__version__ = "1.8.1.dev0"
__version__ = "1.8.1"
QUOTE = "'"
ESCAPE = {"'", "\\"}
......@@ -155,7 +155,7 @@ class Node(object):
@property
def unquoted_name(self):
n = self.name
if n.startswith(QUOTE) and n.endswith(QUOTE):
if n and n.startswith(QUOTE) and n.endswith(QUOTE):
n = n[1:-1]
for esc in ESCAPE:
n = n.replace(esc + QUOTE, QUOTE)
......
......@@ -24,6 +24,9 @@ def test_Node_name():
with pytest.raises(ValueError):
Node(name='A)')
n = Node()
assert n.unquoted_name is None
n = Node("a'b", auto_quote=True)
assert n.name == "'a''b'"
assert n.unquoted_name == "a'b"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment