commonnexus 1.9.1__tar.gz → 1.9.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {commonnexus-1.9.1 → commonnexus-1.9.2}/PKG-INFO +1 -1
- {commonnexus-1.9.1 → commonnexus-1.9.2}/setup.cfg +1 -1
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/__init__.py +1 -1
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/blocks/characters.py +5 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/tokenizer.py +1 -1
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus.egg-info/PKG-INFO +1 -1
- {commonnexus-1.9.1 → commonnexus-1.9.2}/tests/test_blocks_characters.py +53 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/LICENSE +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/README.md +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/pyproject.toml +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/setup.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/__main__.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/blocks/__init__.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/blocks/assumptions.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/blocks/base.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/blocks/codons.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/blocks/distances.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/blocks/notes.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/blocks/sets.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/blocks/taxa.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/blocks/trees.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/blocks/unaligned.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/cli_util.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/command.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/commands/__init__.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/commands/characters.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/commands/combine.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/commands/help.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/commands/normalise.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/commands/split.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/commands/taxa.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/commands/trees.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/nexus.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/tools/__init__.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/tools/combine.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/tools/matrix.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/tools/normalise.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus/util.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus.egg-info/SOURCES.txt +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus.egg-info/dependency_links.txt +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus.egg-info/entry_points.txt +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus.egg-info/not-zip-safe +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus.egg-info/requires.txt +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/src/commonnexus.egg-info/top_level.txt +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/tests/test_blocks_base.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/tests/test_blocks_distances.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/tests/test_blocks_notes.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/tests/test_blocks_sets.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/tests/test_blocks_taxa.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/tests/test_blocks_trees.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/tests/test_cli.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/tests/test_command.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/tests/test_dendropy_examples.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/tests/test_nexus.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/tests/test_regressions.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/tests/test_tokenizer.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/tests/test_tools_combine.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/tests/test_tools_matrix.py +0 -0
- {commonnexus-1.9.1 → commonnexus-1.9.2}/tests/test_tools_normalise.py +0 -0
|
@@ -549,10 +549,15 @@ class Charstatelabels(Payload):
|
|
|
549
549
|
if isinstance(w, Token) and w.text == '/':
|
|
550
550
|
in_states = True
|
|
551
551
|
continue
|
|
552
|
+
if name:
|
|
553
|
+
raise ValueError(
|
|
554
|
+
'Illegal token in charstatelabel: "{}{}"'.format(name, w))
|
|
552
555
|
name = w
|
|
553
556
|
except StopIteration:
|
|
554
557
|
break
|
|
555
558
|
if num:
|
|
559
|
+
if name and name in names:
|
|
560
|
+
duplicate_charlabel(name, 'CHARSTATELABELS', nexus)
|
|
556
561
|
self.characters.append(types.SimpleNamespace(number=num, name=name, states=states))
|
|
557
562
|
elif comma: # There was a comma, but no new label.
|
|
558
563
|
warnings.warn('Trailing comma in CHARSTATELABELS command')
|
|
@@ -11,7 +11,7 @@ Punctuation
|
|
|
11
11
|
|
|
12
12
|
The following punctuation marks have special properties: [ ] do not break a
|
|
13
13
|
word; + and - are allowed as state symbols, but none of the rest are allowed; - is
|
|
14
|
-
considered punctuation except
|
|
14
|
+
considered punctuation except where it is the minus sign in a negative number.
|
|
15
15
|
"""
|
|
16
16
|
import enum
|
|
17
17
|
import itertools
|
|
@@ -267,3 +267,56 @@ def test_Data_with_mixed_charlabels(nexus):
|
|
|
267
267
|
nex = nexus(DATA="DIMENSIONS NCHAR=2; CHARSTATELABELS 1 x, 2 ; MATRIX t1 1 1;")
|
|
268
268
|
m = nex.characters.get_matrix()
|
|
269
269
|
assert '2' in m['t1'], 'unspecified character label'
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
def test_illegal_charstatelabel():
|
|
273
|
+
nex = Nexus("""\
|
|
274
|
+
#NEXUS
|
|
275
|
+
|
|
276
|
+
BEGIN DATA;
|
|
277
|
+
DIMENSIONS NTAX=3 NCHAR=3;
|
|
278
|
+
FORMAT DATATYPE=STANDARD MISSING=? GAP=- SYMBOLS="01";
|
|
279
|
+
CHARSTATELABELS
|
|
280
|
+
1 hand_1,
|
|
281
|
+
2 burn(tr.)_3,
|
|
282
|
+
3 claw(nail)_3
|
|
283
|
+
;
|
|
284
|
+
MATRIX
|
|
285
|
+
A 001
|
|
286
|
+
B 000
|
|
287
|
+
C 000
|
|
288
|
+
;
|
|
289
|
+
END;""")
|
|
290
|
+
with pytest.raises(ValueError) as e:
|
|
291
|
+
_ = nex.DATA.CHARSTATELABELS
|
|
292
|
+
assert 'burn(' in str(e)
|
|
293
|
+
|
|
294
|
+
with pytest.raises(ValueError):
|
|
295
|
+
nex.validate()
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
def test_duplicate_charstatelabels():
|
|
299
|
+
nex = Nexus("""\
|
|
300
|
+
#NEXUS
|
|
301
|
+
|
|
302
|
+
BEGIN DATA;
|
|
303
|
+
DIMENSIONS NTAX=3 NCHAR=3;
|
|
304
|
+
FORMAT DATATYPE=STANDARD MISSING=? GAP=- SYMBOLS="01";
|
|
305
|
+
CHARSTATELABELS
|
|
306
|
+
1 hand_1,
|
|
307
|
+
2 _3,
|
|
308
|
+
3 _3
|
|
309
|
+
;
|
|
310
|
+
MATRIX
|
|
311
|
+
A 001
|
|
312
|
+
B 000
|
|
313
|
+
C 000
|
|
314
|
+
;
|
|
315
|
+
END;""")
|
|
316
|
+
with warnings.catch_warnings(record=True) as w:
|
|
317
|
+
_ = nex.DATA.CHARSTATELABELS
|
|
318
|
+
assert len(w) == 1, 'Expected 1 warning, got %r' % w
|
|
319
|
+
|
|
320
|
+
nex.cfg.strict = True
|
|
321
|
+
with pytest.raises(ValueError):
|
|
322
|
+
_ = nex.DATA.CHARSTATELABELS
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|