Skip to content

Commit

Permalink
Sequence diagram title
Browse files Browse the repository at this point in the history
  • Loading branch information
pylover committed Jun 24, 2021
1 parent 111bb03 commit 1b27ed4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
2 changes: 1 addition & 1 deletion dial/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def _complete(self, caller, callee, text=None):


class SequenceDiagram(Visible, Interpreter, list):
title = None
title = 'Untitled'

def __init__(self, tokenizer):
super().__init__(tokenizer, 'start')
Expand Down
29 changes: 9 additions & 20 deletions tests/test_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def test_sequence_title():
def test_sequence_calltext():
d = SequenceDiagram(Tokenizer())
s = '''# Sequence
title: Foo Bar
foo -> bar: baz
foo -> bar: int baz.qux(quux):int
bar -> baz: thud
Expand All @@ -33,6 +35,8 @@ def test_sequence_calltext():
def test_sequence_hierarchy():
d = SequenceDiagram(Tokenizer())
s = '''# Sequence
title: Foo Bar
foo -> bar
foo -> baz
baz -> qux
Expand All @@ -47,36 +51,21 @@ def test_sequence_hierarchy():


def test_interpreter_badsyntax():
d = SequenceDiagram(Tokenizer(), 'foo')
d = SequenceDiagram(Tokenizer())
with pytest.raises(BadSyntax) as e:
d.parse('foo')
assert str(e.value) == '''\
File "String", Interpreter SequenceDiagram, line 2, col 0
Expected `->`, got: EOF.\
Expected one of `->|:`, got: EOF.\
'''

d = SequenceDiagram(Tokenizer(), 'foo')
with pytest.raises(BadSyntax) as e:
d.parse('foo::')
assert str(e.value) == '''\
File "String", Interpreter SequenceDiagram, line 1, col 3
Expected `->`, got: COLON ":".\
'''

d = SequenceDiagram(Tokenizer(), 'foo')
d = SequenceDiagram(Tokenizer())
with pytest.raises(BadSyntax) as e:
d.parse('''
foo:
foo
bar
''')
assert str(e.value) == '''\
File "String", Interpreter SequenceDiagram, line 2, col 15
Expected `->`, got: COLON ":".\
'''
d = SequenceDiagram(Tokenizer(), 'foo')
with pytest.raises(BadSyntax) as e:
d.parse('foo: bar: baz')
assert str(e.value) == '''\
File "String", Interpreter SequenceDiagram, line 1, col 3
Expected `->`, got: COLON ":".\
Expected one of `->|:`, got: NEWLINE.\
'''

0 comments on commit 1b27ed4

Please sign in to comment.