@@ -551,6 +551,68 @@ def md5sum(filename, blocksize=65536):
551551 self .assertFalse (task .command .parts [0 ].strip ().startswith ("<<<" ))
552552 self .assertFalse (task .command .parts [- 1 ].strip ().endswith (">>>" ))
553553
554+ def test_hints (self ):
555+ txt = """
556+ task t {
557+ input {
558+ Array[File] files
559+ }
560+ command <<<
561+ set -euxo pipefail
562+ mkdir files_out
563+ find _miniwdl_inputs -type f -print0 | xargs -0 -iXXX cp XXX files_out/
564+ >>>
565+ output {
566+ Array[File] files_out = glob("files_out/*")
567+ }
568+ runtime {
569+ container: ["ubuntu:20.04"]
570+ }
571+ hints {
572+ short_task: true
573+ inputs: input {
574+ files: hints {
575+ localization_optional: true
576+ }
577+ }
578+ }
579+ }
580+ """
581+ task = WDL .parse_tasks (txt , version = "1.2" )[0 ]
582+ # TODO: test AST repr when implemented
583+
584+ txt = """
585+ task t {
586+ input {
587+ Array[File] files
588+ }
589+ command <<<
590+ set -euxo pipefail
591+ mkdir files_out
592+ find _miniwdl_inputs -type f -print0 | xargs -0 -iXXX cp XXX files_out/
593+ >>>
594+ output {
595+ Array[File] files_out = glob("files_out/*")
596+ }
597+ runtime {
598+ container: ["ubuntu:20.04"]
599+ }
600+ hints {
601+ short_task: true
602+ inputs: input {
603+ files: hints {
604+ localization_optional: true
605+ }
606+ }
607+ }
608+ hints {
609+ bogus: true
610+ }
611+ }
612+ """
613+ with self .assertRaises (WDL .Error .MultipleDefinitions ):
614+ WDL .parse_tasks (txt , version = "1.2" )[0 ].typecheck ()
615+
554616
555617class TestTypes (unittest .TestCase ):
556618 def test_parser (self ):
@@ -2515,6 +2577,49 @@ def test_keywords(self):
25152577 self .assertIsInstance (err .pos .line , int )
25162578 self .assertIsInstance (err .pos .column , int )
25172579
2580+ def test_workflow_hints (self ):
2581+ doc = r"""version 1.2
2582+ workflow w {
2583+ input {
2584+ Array[String] names
2585+ }
2586+ scatter (name in names) {
2587+ String greeting = "Hello, " + name + "!"
2588+ }
2589+ output {
2590+ Array[String] greetings = greeting
2591+ }
2592+ hints {
2593+ allow_nested_inputs: true
2594+ }
2595+ }
2596+ """
2597+ doc = WDL .parse_document (doc )
2598+ doc .typecheck ()
2599+ # TODO: check hints AST once implemented
2600+
2601+ doc = r"""version 1.2
2602+ workflow w {
2603+ input {
2604+ Array[String] names
2605+ }
2606+ scatter (name in names) {
2607+ String greeting = "Hello, " + name + "!"
2608+ }
2609+ output {
2610+ Array[String] greetings = greeting
2611+ }
2612+ hints {
2613+ allow_nested_inputs: true
2614+ }
2615+ hints {
2616+ bogus: true
2617+ }
2618+ }
2619+ """
2620+ with self .assertRaises (WDL .Error .MultipleDefinitions ):
2621+ WDL .parse_document (doc )
2622+
25182623class TestNoneLiteral (unittest .TestCase ):
25192624 def test_none_expr (self ):
25202625 doc = r"""
0 commit comments