Skip to content

Commit

Permalink
Fix SyntaxWarning: invalid escape sequence '\['
Browse files Browse the repository at this point in the history
Signed-off-by: d10n <[email protected]>
  • Loading branch information
d10n committed Nov 14, 2024
1 parent 88de404 commit 25bb44a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions tests/trestle/core/control_io_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
case_3 = 'indent end abrupt'
case_4 = 'no items'

control_text = """---
control_text = r"""---
x-trestle-global:
sort-id: xy-09
---
Expand Down Expand Up @@ -132,7 +132,7 @@ def test_read_write_controls(
part_b3 = common.Part(id='ac-1_smt.b.3', name='item', prose='b.3 prose', props=[prop])
prop.value = 'c'
part_c = common.Part(id='ac-1_smt.c', name='item', prose='c prose', props=[prop])
sec_1_text = """
sec_1_text = r"""
General comment
on separate lines
Expand Down Expand Up @@ -425,7 +425,7 @@ def test_merge_control_update(tmp_path: pathlib.Path, testdata_dir: pathlib.Path
assert context.comp_dict['This System']['d.'].status.state == 'planned', 'New template state must be merged'


statement_text = """
statement_text = r"""
# xy-9 - \[My Group Title\] Fancy Control
Expand Down
4 changes: 2 additions & 2 deletions trestle/core/control_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ class ControlInterface:

@staticmethod
def _wrap_label(label: str):
l_side = '\['
r_side = '\]'
l_side = r'\['
r_side = r'\]'
wrapped = '' if label == '' else f'{l_side}{label}{r_side}'
return wrapped

Expand Down
2 changes: 1 addition & 1 deletion trestle/core/control_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _add_control_statement(self, control: cat.Control, group_title: str, print_g
control_title = control.title

if print_group_title:
group_name = ' \[' + group_title + '\]'
group_name = r' \[' + group_title + r'\]'

title = f'{control_id} -{group_name} {control_title}'

Expand Down

0 comments on commit 25bb44a

Please sign in to comment.