|
3 | 3 | from pathlib import Path
|
4 | 4 | import random
|
5 | 5 | import platform
|
| 6 | +import typing as ty |
6 | 7 | import pytest
|
7 | 8 | import attrs
|
8 | 9 | import cloudpickle as cp
|
|
17 | 18 | position_sort,
|
18 | 19 | parse_copyfile,
|
19 | 20 | argstr_formatting,
|
| 21 | + parse_format_string, |
20 | 22 | )
|
21 | 23 | from ...utils.hash import hash_function
|
22 | 24 | from ..core import Workflow
|
@@ -51,7 +53,7 @@ def test_hash_file(tmpdir):
|
51 | 53 | with open(outdir / "test.file", "w") as fp:
|
52 | 54 | fp.write("test")
|
53 | 55 | assert (
|
54 |
| - hash_function(File(outdir / "test.file")) == "37fcc546dce7e59585f3217bb4c30299" |
| 56 | + hash_function(File(outdir / "test.file")) == "f32ab20c4a86616e32bf2504e1ac5a22" |
55 | 57 | )
|
56 | 58 |
|
57 | 59 |
|
@@ -330,3 +332,33 @@ class Inputs:
|
330 | 332 | )
|
331 | 333 | == "1 2.000000 -test 3 -me 4"
|
332 | 334 | )
|
| 335 | + |
| 336 | + |
| 337 | +def test_parse_format_string1(): |
| 338 | + assert parse_format_string("{a}") == {"a"} |
| 339 | + |
| 340 | + |
| 341 | +def test_parse_format_string2(): |
| 342 | + assert parse_format_string("{abc}") == {"abc"} |
| 343 | + |
| 344 | + |
| 345 | +def test_parse_format_string3(): |
| 346 | + assert parse_format_string("{a:{b}}") == {"a", "b"} |
| 347 | + |
| 348 | + |
| 349 | +def test_parse_format_string4(): |
| 350 | + assert parse_format_string("{a:{b[2]}}") == {"a", "b"} |
| 351 | + |
| 352 | + |
| 353 | +def test_parse_format_string5(): |
| 354 | + assert parse_format_string("{a.xyz[somekey].abc:{b[a][b].d[0]}}") == {"a", "b"} |
| 355 | + |
| 356 | + |
| 357 | +def test_parse_format_string6(): |
| 358 | + assert parse_format_string("{a:05{b[a 2][b].e}}") == {"a", "b"} |
| 359 | + |
| 360 | + |
| 361 | +def test_parse_format_string7(): |
| 362 | + assert parse_format_string( |
| 363 | + "{a1_field} {b2_field:02f} -test {c3_field[c]} -me {d4_field[0]}" |
| 364 | + ) == {"a1_field", "b2_field", "c3_field", "d4_field"} |
0 commit comments