diff --git a/docs/sections/contributor_guide/documentation.rst b/docs/sections/contributor_guide/documentation.rst index ee82459cf..eb2426a5a 100644 --- a/docs/sections/contributor_guide/documentation.rst +++ b/docs/sections/contributor_guide/documentation.rst @@ -52,7 +52,7 @@ Please follow these guidelines when contributing to the documentation: .. code-block:: python - n = 88 + n = 42 or @@ -62,4 +62,4 @@ Please follow these guidelines when contributing to the documentation: .. code-block:: python - n = 88 + n = 42 diff --git a/src/uwtools/tests/api/test_config.py b/src/uwtools/tests/api/test_config.py index a9c43cb9a..71796c814 100644 --- a/src/uwtools/tests/api/test_config.py +++ b/src/uwtools/tests/api/test_config.py @@ -99,7 +99,7 @@ def test_realize_update_config_from_stdin(): def test_realize_update_config_none(): - input_config = {"n": 88} + input_config = {"n": 42} output_file = Path("output.yaml") with patch.object(config, "_realize") as _realize: config.realize(input_config=input_config, output_file=output_file) diff --git a/src/uwtools/tests/api/test_execute.py b/src/uwtools/tests/api/test_execute.py index b81b39c76..e663d82d0 100644 --- a/src/uwtools/tests/api/test_execute.py +++ b/src/uwtools/tests/api/test_execute.py @@ -25,7 +25,7 @@ def args(): config=fixture_path("testdriver.yaml"), module=fixture_path("testdriver.py"), schema_file=fixture_path("testdriver.jsonschema"), - task="eighty_eight", + task="forty_two", ) @@ -98,7 +98,7 @@ def test_tasks_fail_no_cycle(args, caplog, kwargs): @mark.parametrize("f", [Path, str]) def test_tasks_pass(args, f): tasks = execute.tasks(classname=args.classname, module=f(args.module)) - assert tasks["eighty_eight"] == "88" + assert tasks["forty_two"] == "42" def test__get_driver_class_explicit_fail_bad_class(caplog, args): diff --git a/src/uwtools/tests/config/formats/test_base.py b/src/uwtools/tests/config/formats/test_base.py index a4ba27c87..e3995e751 100644 --- a/src/uwtools/tests/config/formats/test_base.py +++ b/src/uwtools/tests/config/formats/test_base.py @@ -25,7 +25,7 @@ @fixture def config(tmp_path): path = tmp_path / "config.yaml" - data = {"foo": 88} + data = {"foo": 42} with open(path, "w", encoding="utf-8") as f: yaml.dump(data, f) return ConcreteConfig(config=path) @@ -67,7 +67,7 @@ def dump_dict(cfg, path=None): def test__characterize_values(config): - values = {1: "", 2: None, 3: "{{ n }}", 4: {"a": 88}, 5: [{"b": 99}], 6: "string"} + values = {1: "", 2: None, 3: "{{ n }}", 4: {"a": 42}, 5: [{"b": 43}], 6: "string"} complete, template = config._characterize_values(values=values, parent="p") assert complete == [" p1", " p2", " p4", " p4.a", " pb", " p5", " p6"] assert template == [" p3: {{ n }}"] @@ -153,10 +153,10 @@ def test_dereference(tmp_path): c: !int '{{ N | int + 11 }}' d: '{{ X }}' e: - - !int '88' + - !int '42' - !float '3.14' f: - f1: !int '88' + f1: !int '42' f2: !float '3.14' N: "22" """.strip() @@ -170,8 +170,8 @@ def test_dereference(tmp_path): "a": 44, "b": {"c": 33}, "d": "{{ X }}", - "e": [88, 3.14], - "f": {"f1": 88, "f2": 3.14}, + "e": [42, 3.14], + "f": {"f1": 42, "f2": 3.14}, "N": "22", } @@ -206,4 +206,4 @@ def test_update_from(config): Test that a config object can be updated. """ config.data.update({"a": "11", "b": "12", "c": "13"}) - assert config == {"foo": 88, "a": "11", "b": "12", "c": "13"} + assert config == {"foo": 42, "a": "11", "b": "12", "c": "13"} diff --git a/src/uwtools/tests/config/formats/test_nml.py b/src/uwtools/tests/config/formats/test_nml.py index c91c16dde..a0116556c 100644 --- a/src/uwtools/tests/config/formats/test_nml.py +++ b/src/uwtools/tests/config/formats/test_nml.py @@ -58,22 +58,22 @@ def test_nml__parse_include_mult_sect(): def test_nml_derived_type_dict(): - nml = NMLConfig(config={"nl": {"o": {"i": 77, "j": 88}}}) - assert nml["nl"]["o"] == {"i": 77, "j": 88} + nml = NMLConfig(config={"nl": {"o": {"i": 41, "j": 42}}}) + assert nml["nl"]["o"] == {"i": 41, "j": 42} def test_nml_derived_type_file(tmp_path): s = """ &nl - o%i = 77 - o%j = 88 + o%i = 41 + o%j = 42 / """ path = tmp_path / "a.nml" with open(path, "w", encoding="utf-8") as f: print(dedent(s).strip(), file=f) nml = NMLConfig(config=path) - assert nml["nl"]["o"] == {"i": 77, "j": 88} + assert nml["nl"]["o"] == {"i": 41, "j": 42} def test_nml_dump_dict_dict(data, tmp_path): diff --git a/src/uwtools/tests/config/formats/test_yaml.py b/src/uwtools/tests/config/formats/test_yaml.py index 98a374d59..a7d84ece9 100644 --- a/src/uwtools/tests/config/formats/test_yaml.py +++ b/src/uwtools/tests/config/formats/test_yaml.py @@ -155,7 +155,7 @@ def test_yaml_constructor_error_not_dict_from_file(tmp_path): def test_yaml_constructor_error_not_dict_from_stdin(): # Test that a useful exception is raised if the YAML stdin input is a non-dict value. - with StringIO("88") as sio, patch.object(sys, "stdin", new=sio): + with StringIO("42") as sio, patch.object(sys, "stdin", new=sio): with raises(exceptions.UWConfigError) as e: YAMLConfig() assert "Parsed an int value from stdin, expected a dict" in str(e.value) @@ -201,7 +201,7 @@ def test_yaml_stdin_plus_relpath_failure(caplog): def test_yaml_unexpected_error(tmp_path): cfgfile = tmp_path / "cfg.yaml" with open(cfgfile, "w", encoding="utf-8") as f: - print("{n: 88}", file=f) + print("{n: 42}", file=f) with patch.object(yaml, "load") as load: msg = "Unexpected error" load.side_effect = yaml.constructor.ConstructorError(note=msg) diff --git a/src/uwtools/tests/config/test_jinja2.py b/src/uwtools/tests/config/test_jinja2.py index c1ef18611..6b10bdf91 100644 --- a/src/uwtools/tests/config/test_jinja2.py +++ b/src/uwtools/tests/config/test_jinja2.py @@ -108,7 +108,7 @@ def test_dereference_local_values(): } -@mark.parametrize("val", (True, 3.14, 88, None)) +@mark.parametrize("val", (True, 3.14, 42, None)) def test_dereference_no_op(val): # These types of values pass through dereferencing unmodified: assert jinja2.dereference(val=val, context={}) == val @@ -157,7 +157,7 @@ def test_dereference_str_filter_rendered(): def test_derefrence_str_variable_rendered_mixed(): # A mixed result remains a str. val = "{{ n }} is an {{ t }}" - assert jinja2.dereference(val=val, context={"n": 88, "t": "int"}) == "88 is an int" + assert jinja2.dereference(val=val, context={"n": 42, "t": "int"}) == "42 is an int" def test_dereference_str_variable_rendered_str(): @@ -290,7 +290,7 @@ def test__deref_convert_no(caplog, tag): assert regex_logged(caplog, "Conversion failed") -@mark.parametrize("converted,tag,value", [(3.14, "!float", "3.14"), (88, "!int", "88")]) +@mark.parametrize("converted,tag,value", [(3.14, "!float", "3.14"), (42, "!int", "42")]) def test__deref_convert_ok(caplog, converted, tag, value): log.setLevel(logging.DEBUG) loader = yaml.SafeLoader(os.devnull) @@ -340,10 +340,10 @@ def test__report(caplog): Internal arguments when rendering template: --------------------------------------------------------------------- foo: bar -longish_variable: 88 +longish_variable: 42 --------------------------------------------------------------------- """.strip() - jinja2._report(dict(foo="bar", longish_variable=88)) + jinja2._report(dict(foo="bar", longish_variable=42)) assert "\n".join(record.message for record in caplog.records) == expected @@ -541,7 +541,7 @@ def test_searchpath_stdin_explicit(self, searchpath_assets): assert J2Template(values={}, searchpath=[a.d1]).render() == "2" def test_undeclared_variables(self): - s = "{{ a }} {{ b.c }} {{ d.e.f[g] }} {{ h[i] }} {{ j[88] }} {{ k|default(l) }}" + s = "{{ a }} {{ b.c }} {{ d.e.f[g] }} {{ h[i] }} {{ j[42] }} {{ k|default(l) }}" uvs = {"a", "b", "d", "g", "h", "i", "j", "k", "l"} assert J2Template(values={}, template_source=s).undeclared_variables == uvs diff --git a/src/uwtools/tests/config/test_support.py b/src/uwtools/tests/config/test_support.py index ddbae129b..409f6edad 100644 --- a/src/uwtools/tests/config/test_support.py +++ b/src/uwtools/tests/config/test_support.py @@ -21,7 +21,7 @@ from uwtools.utils.file import FORMAT -@mark.parametrize("d,n", [({1: 88}, 1), ({1: {2: 88}}, 2), ({1: {2: {3: 88}}}, 3), ({1: {}}, 2)]) +@mark.parametrize("d,n", [({1: 42}, 1), ({1: {2: 42}}, 2), ({1: {2: {3: 42}}}, 3), ({1: {}}, 2)]) def test_depth(d, n): assert support.depth(d) == n @@ -103,13 +103,13 @@ def test_int_no(self, loader): ts.convert() def test_int_ok(self, loader): - ts = support.UWYAMLConvert(loader, yaml.ScalarNode(tag="!int", value="88")) - assert ts.convert() == 88 - self.comp(ts, "!int '88'") + ts = support.UWYAMLConvert(loader, yaml.ScalarNode(tag="!int", value="42")) + assert ts.convert() == 42 + self.comp(ts, "!int '42'") def test___repr__(self, loader): - ts = support.UWYAMLConvert(loader, yaml.ScalarNode(tag="!int", value="88")) - assert str(ts) == "!int 88" + ts = support.UWYAMLConvert(loader, yaml.ScalarNode(tag="!int", value="42")) + assert str(ts) == "!int 42" class Test_UWYAMLRemove: diff --git a/src/uwtools/tests/config/test_tools.py b/src/uwtools/tests/config/test_tools.py index c80be3d6d..f42ffcdd3 100644 --- a/src/uwtools/tests/config/test_tools.py +++ b/src/uwtools/tests/config/test_tools.py @@ -32,7 +32,7 @@ @fixture def compare_configs_assets(tmp_path): - d = {"foo": {"bar": 88}, "baz": {"qux": 99}} + d = {"foo": {"bar": 42}, "baz": {"qux": 43}} a = tmp_path / "a" b = tmp_path / "b" with writable(a) as f: @@ -50,7 +50,7 @@ def realize_config_testobj(realize_config_yaml_input): @fixture def realize_config_yaml_input(tmp_path): path = tmp_path / "a.yaml" - d = {1: {2: {3: 88}}} # depth 3 + d = {1: {2: {3: 42}}} # depth 3 with writable(path) as f: yaml.dump(d, f) return path @@ -117,7 +117,7 @@ def test_compare_configs_changed_value(compare_configs_assets, caplog): assert not tools.compare_configs( config_1_path=a, config_1_format=FORMAT.yaml, config_2_path=b, config_2_format=FORMAT.yaml ) - assert logged(caplog, "baz: qux: - 99 + 11") + assert logged(caplog, "baz: qux: - 43 + 11") def test_compare_configs_missing_key(compare_configs_assets, caplog): @@ -130,7 +130,7 @@ def test_compare_configs_missing_key(compare_configs_assets, caplog): assert not tools.compare_configs( config_1_path=b, config_1_format=FORMAT.yaml, config_2_path=a, config_2_format=FORMAT.yaml ) - assert logged(caplog, "baz: qux: - None + 99") + assert logged(caplog, "baz: qux: - None + 43") def test_compare_configs_bad_format(caplog): @@ -544,7 +544,7 @@ def test__ensure_format_bad_no_path_no_format(): def test__ensure_format_config_obj(): - config = NMLConfig({"nl": {"n": 88}}) + config = NMLConfig({"nl": {"n": 42}}) assert tools._ensure_format(desc="foo", config=config) == FORMAT.nml @@ -653,7 +653,7 @@ def test__realize_config_input_setup_ini_stdin(caplog): data = """ [section] foo = bar - baz = 88 + baz = 42 """ stdinproxy.cache_clear() log.setLevel(logging.DEBUG) @@ -662,7 +662,7 @@ def test__realize_config_input_setup_ini_stdin(caplog): sio.seek(0) with patch.object(sys, "stdin", new=sio): input_obj = tools._realize_config_input_setup(input_format=FORMAT.ini) - assert input_obj.data == {"section": {"foo": "bar", "baz": "88"}} # note: 88 is str, not int + assert input_obj.data == {"section": {"foo": "bar", "baz": "42"}} # note: 42 is str, not int assert logged(caplog, "Reading input from stdin") @@ -780,24 +780,24 @@ def test__realize_config_output_setup(caplog, tmp_path): def test__realize_config_update_cfgobj(realize_config_testobj): - assert realize_config_testobj[1][2][3] == 88 - update_config = YAMLConfig(config={1: {2: {3: 99}}}) + assert realize_config_testobj[1][2][3] == 42 + update_config = YAMLConfig(config={1: {2: {3: 43}}}) o = tools._realize_config_update(input_obj=realize_config_testobj, update_config=update_config) - assert o[1][2][3] == 99 + assert o[1][2][3] == 43 def test__realize_config_update_stdin(caplog, realize_config_testobj): stdinproxy.cache_clear() log.setLevel(logging.DEBUG) - assert realize_config_testobj[1][2][3] == 88 + assert realize_config_testobj[1][2][3] == 42 with StringIO() as sio: - print("{1: {2: {3: 99}}}", file=sio) + print("{1: {2: {3: 43}}}", file=sio) sio.seek(0) with patch.object(sys, "stdin", new=sio): o = tools._realize_config_update( input_obj=realize_config_testobj, update_format=FORMAT.yaml ) - assert o[1][2][3] == 99 + assert o[1][2][3] == 43 assert logged(caplog, "Reading update from stdin") @@ -806,13 +806,13 @@ def test__realize_config_update_noop(realize_config_testobj): def test__realize_config_update_file(realize_config_testobj, tmp_path): - assert realize_config_testobj[1][2][3] == 88 - values = {1: {2: {3: 99}}} + assert realize_config_testobj[1][2][3] == 42 + values = {1: {2: {3: 43}}} update_config = tmp_path / "config.yaml" with open(update_config, "w", encoding="utf-8") as f: yaml.dump(values, f) o = tools._realize_config_update(input_obj=realize_config_testobj, update_config=update_config) - assert o[1][2][3] == 99 + assert o[1][2][3] == 43 def test__realize_config_values_needed(caplog, tmp_path): diff --git a/src/uwtools/tests/config/test_validator.py b/src/uwtools/tests/config/test_validator.py index c7f58b3d3..ff8ef9a29 100644 --- a/src/uwtools/tests/config/test_validator.py +++ b/src/uwtools/tests/config/test_validator.py @@ -35,7 +35,7 @@ def config(tmp_path) -> dict[str, Any]: return { "color": "blue", "dir": str(tmp_path), - "number": 88, + "number": 42, "sub": { "dir": str(tmp_path), }, @@ -59,7 +59,7 @@ def rocoto_assets(): "metatask": { "var": {"member": "foo bar baz"}, "task": { - "cores": 88, + "cores": 42, "command": "some-command", "walltime": "00:01:00", "dependency": { diff --git a/src/uwtools/tests/drivers/test_upp.py b/src/uwtools/tests/drivers/test_upp.py index 55b34cb52..bd7712c0f 100644 --- a/src/uwtools/tests/drivers/test_upp.py +++ b/src/uwtools/tests/drivers/test_upp.py @@ -121,7 +121,7 @@ def test_UPP_namelist_file(caplog, driverobj): log.setLevel(logging.DEBUG) datestr = "2024-05-05_12:00:00" with open(driverobj.config["namelist"]["base_file"], "w", encoding="utf-8") as f: - print("&model_inputs datestr='%s' / &nampgb kpv=88 /" % datestr, file=f) + print("&model_inputs datestr='%s' / &nampgb kpv=42 /" % datestr, file=f) dst = driverobj.rundir / "itag" assert not dst.is_file() path = Path(refs(driverobj.namelist_file())) @@ -132,7 +132,7 @@ def test_UPP_namelist_file(caplog, driverobj): assert nml["model_inputs"]["datestr"] == datestr assert nml["model_inputs"]["grib"] == "grib2" assert nml["nampgb"]["kpo"] == 3 - assert nml["nampgb"]["kpv"] == 88 + assert nml["nampgb"]["kpv"] == 42 def test_UPP_namelist_file_fails_validation(caplog, driverobj): diff --git a/src/uwtools/tests/fixtures/testdriver.py b/src/uwtools/tests/fixtures/testdriver.py index 025a7df55..e01754275 100644 --- a/src/uwtools/tests/fixtures/testdriver.py +++ b/src/uwtools/tests/fixtures/testdriver.py @@ -9,12 +9,12 @@ class TestDriver(AssetsCycleBased): """ @task - def eighty_eight(self): + def forty_two(self): """ - 88 + 42 """ - yield "88" - yield asset(88, lambda: True) + yield "42" + yield asset(42, lambda: True) yield None @classmethod diff --git a/src/uwtools/tests/test_cli.py b/src/uwtools/tests/test_cli.py index d66f9f7f6..d64b458c2 100644 --- a/src/uwtools/tests/test_cli.py +++ b/src/uwtools/tests/test_cli.py @@ -175,7 +175,7 @@ def test__dispatch_execute(): "dry_run": False, "graph_file": None, "key_path": ["foo", "bar"], - "task": "eighty_eight", + "task": "forty_two", "stdin_ok": True, } with patch.object(cli.uwtools.api.execute, "execute") as execute: @@ -183,7 +183,7 @@ def test__dispatch_execute(): execute.assert_called_once_with( classname="TestDriver", module="testdriver", - task="eighty_eight", + task="forty_two", schema_file="/path/to/testdriver.jsonschema", key_path=["foo", "bar"], dry_run=False, @@ -475,7 +475,7 @@ def test__dispatch_template_render_fail(valsneeded): STR.outfile: 2, STR.valsfile: 3, STR.valsfmt: 4, - STR.keyvalpairs: ["foo=88", "bar=99"], + STR.keyvalpairs: ["foo=42", "bar=43"], STR.env: 5, STR.searchpath: 6, STR.valsneeded: valsneeded, @@ -519,7 +519,7 @@ def test__dispatch_template_render_yaml(): STR.outfile: 2, STR.valsfile: 3, STR.valsfmt: 4, - STR.keyvalpairs: ["foo=88", "bar=99"], + STR.keyvalpairs: ["foo=42", "bar=43"], STR.env: 5, STR.searchpath: 6, STR.valsneeded: 7, @@ -532,7 +532,7 @@ def test__dispatch_template_render_yaml(): output_file=2, values_src=3, values_format=4, - overrides={"foo": "88", "bar": "99"}, + overrides={"foo": "42", "bar": "43"}, env=5, searchpath=6, values_needed=7, @@ -684,7 +684,7 @@ def test_main_fail_exception_log(): def test__parse_args(): - raw_args = ["testing", "--bar", "88"] + raw_args = ["testing", "--bar", "42"] with patch.object(cli, "Parser") as Parser: cli._parse_args(raw_args) Parser.assert_called_once() diff --git a/src/uwtools/tests/test_fs.py b/src/uwtools/tests/test_fs.py index 4d9189f6c..b313267bd 100644 --- a/src/uwtools/tests/test_fs.py +++ b/src/uwtools/tests/test_fs.py @@ -112,7 +112,7 @@ def test_Stager__config_block_fail_bad_key_path(assets, source): assert str(e.value) == "Failed following YAML key(s): a -> x" -@mark.parametrize("val", [None, True, False, "str", 88, 3.14, [], tuple()]) +@mark.parametrize("val", [None, True, False, "str", 42, 3.14, [], tuple()]) def test_Stager__config_block_fails_bad_type(assets, val): dstdir, cfgdict, _ = assets cfgdict["a"]["b"] = val diff --git a/src/uwtools/tests/test_rocoto.py b/src/uwtools/tests/test_rocoto.py index 2c8b3fb67..d7e5323b2 100644 --- a/src/uwtools/tests/test_rocoto.py +++ b/src/uwtools/tests/test_rocoto.py @@ -118,18 +118,18 @@ def test__add_compound_time_string_basic(self, instance, root): assert child.text == "bar" def test__add_compound_time_string_cyclestr(self, instance, root): - config = {"attrs": {"bar": "88"}, "cyclestr": {"attrs": {"baz": "99"}, "value": "qux"}} + config = {"attrs": {"bar": "42"}, "cyclestr": {"attrs": {"baz": "43"}, "value": "qux"}} instance._add_compound_time_string(e=root, config=config, tag="foo") child = root[0] - assert child.get("bar") == "88" + assert child.get("bar") == "42" cyclestr = child[0] - assert cyclestr.get("baz") == "99" + assert cyclestr.get("baz") == "43" assert cyclestr.text == "qux" def test__add_metatask(self, instance, root): config = { "metatask_foo": "1", - "attrs": {"mode": "parallel", "throttle": 88}, + "attrs": {"mode": "parallel", "throttle": 42}, "task_bar": "2", "var": {"baz": "3", "qux": "4"}, } @@ -141,7 +141,7 @@ def test__add_metatask(self, instance, root): assert metatask.tag == "metatask" assert metatask.get("mode") == "parallel" assert metatask.get("name") == taskname - assert metatask.get("throttle") == "88" + assert metatask.get("throttle") == "42" assert {e.get("name"): e.text for e in metatask.xpath("var")} == {"baz": "3", "qux": "4"} mocks["_add_metatask"].assert_called_once_with(metatask, "1", "foo") mocks["_add_task"].assert_called_once_with(metatask, "2", "bar") diff --git a/src/uwtools/tests/test_schemas.py b/src/uwtools/tests/test_schemas.py index cd549a0eb..b2d616209 100644 --- a/src/uwtools/tests/test_schemas.py +++ b/src/uwtools/tests/test_schemas.py @@ -308,7 +308,7 @@ def test_schema_batchargs(): # Managed properties are fine: assert not errors({"queue": "string", "walltime": "00:05:00"}) # But so are unknown ones: - assert not errors({"--foo": 88, "walltime": "00:05:00"}) + assert not errors({"--foo": 42, "walltime": "00:05:00"}) # It just has to be a map: assert "[] is not of type 'object'\n" in errors([]) # The "threads" argument is not allowed: It will be propagated, if set, from execution.threads. @@ -510,7 +510,7 @@ def test_schema_chgres_cube_namelist(chgres_cube_config, chgres_cube_prop): # Just base_file is ok: assert not errors(with_del(namelist, "update_values")) # base_file must be a string: - assert "88 is not of type 'string'\n" in errors(with_set(namelist, 88, "base_file")) + assert "42 is not of type 'string'\n" in errors(with_set(namelist, 42, "base_file")) # Just update_values is ok: assert not errors(with_del(namelist, "base_file")) # config is required with update_values: @@ -528,7 +528,7 @@ def test_schema_chgres_cube_namelist_update_values(chgres_cube_config, chgres_cu for key in ["mosaic_file_target_grid", "vcoord_file_target_grid"]: assert "is a required property" in errors(with_del(config, key)) # Additional entries of namelist-compatible types are permitted: - for val in [[1, 2, 3], True, 88, 3.14, "bar"]: + for val in [[1, 2, 3], True, 42, 3.14, "bar"]: assert not errors(with_set(config, val, "foo")) # Namelist values must be of the correct type: # boolean: @@ -620,7 +620,7 @@ def test_schema_esg_grid_namelist(esg_grid_prop, esg_namelist): # Just base_file is ok: assert not errors(esg_namelist) # base_file must be a string: - assert "not valid" in errors({**esg_namelist, "base_file": 88}) + assert "not valid" in errors({**esg_namelist, "base_file": 42}) # Just update_values is ok, if it is complete: assert not errors(with_del(esg_namelist, "base_file")) # If base_file is not supplied, any missing namelist key is an error: @@ -639,13 +639,13 @@ def test_schema_esg_grid_namelist(esg_grid_prop, esg_namelist): def test_schema_esg_grid_namelist_content(key): config: dict = { "regional_grid_nml": { - "delx": 88, - "dely": 88, - "lx": 88, - "ly": 88, - "pazi": 88, - "plat": 88, - "plon": 88, + "delx": 42, + "dely": 42, + "lx": 42, + "ly": 42, + "pazi": 42, + "plat": 42, + "plon": 42, } } errors = partial(schema_validator("esg-grid", "$defs", "namelist_content")) @@ -664,7 +664,7 @@ def test_schema_esg_grid_rundir(esg_grid_prop): errors = esg_grid_prop("rundir") # Must be a string: assert not errors("/some/path") - assert "88 is not of type 'string'\n" in errors(88) + assert "42 is not of type 'string'\n" in errors(42) # execution @@ -697,7 +697,7 @@ def test_schema_execution_executable(): # String value is ok: assert not errors("fv3.exe") # Anything else is not: - assert "88 is not of type 'string'\n" in errors(88) + assert "42 is not of type 'string'\n" in errors(42) def test_schema_execution_mpiargs(): @@ -707,7 +707,7 @@ def test_schema_execution_mpiargs(): # mpiargs may be empty: assert not errors([]) # String values are expected: - assert "88 is not of type 'string'\n" in errors(["string1", 88]) + assert "42 is not of type 'string'\n" in errors(["string1", 42]) def test_schema_execution_threads(): @@ -883,7 +883,7 @@ def test_schema_fv3_diag_table(fv3_prop): # String value is ok: assert not errors("/path/to/file") # Anything else is not: - assert "88 is not of type 'string'\n" in errors(88) + assert "42 is not of type 'string'\n" in errors(42) def test_schema_fv3_domain(fv3_prop): @@ -912,7 +912,7 @@ def test_schema_fv3_lateral_boundary_conditions(fv3_prop): assert "-1 is less than the minimum of 0" in errors(with_set(config, -1, "offset")) assert "'s' is not of type 'integer'\n" in errors(with_set(config, "s", "offset")) # path must be a string: - assert "88 is not of type 'string'\n" in errors(with_set(config, 88, "path")) + assert "42 is not of type 'string'\n" in errors(with_set(config, 42, "path")) def test_schema_fv3_length(fv3_prop): @@ -929,12 +929,12 @@ def test_schema_fv3_length(fv3_prop): def test_schema_fv3_model_configure(fv3_prop): base_file = {"base_file": "/some/path"} - update_values = {"update_values": {"foo": 88}} + update_values = {"update_values": {"foo": 42}} errors = fv3_prop("model_configure") # Just base_file is ok: assert not errors(base_file) # But base_file must be a string: - assert "88 is not of type 'string'\n" in errors({"base_file": 88}) + assert "42 is not of type 'string'\n" in errors({"base_file": 42}) # Just update_values is ok: assert not errors(update_values) # A combination of base_file and update_values is ok: @@ -946,7 +946,7 @@ def test_schema_fv3_model_configure(fv3_prop): def test_schema_fv3_model_configure_update_values(fv3_prop): errors = fv3_prop("model_configure", "properties", "update_values") # boolean, number, and string values are ok: - assert not errors({"bool": True, "int": 88, "float": 3.14, "string": "foo"}) + assert not errors({"bool": True, "int": 42, "float": 3.14, "string": "foo"}) # Other types are not, e.g.: assert "None is not of type 'boolean', 'number', 'string'\n" in errors({"null": None}) # At least one entry is required: @@ -960,7 +960,7 @@ def test_schema_fv3_namelist(fv3_prop): # Just base_file is ok: assert not errors(base_file) # base_file must be a string: - assert "88 is not of type 'string'\n" in errors({"base_file": 88}) + assert "42 is not of type 'string'\n" in errors({"base_file": 42}) # Just update_values is ok: assert not errors(update_values) # A combination of base_file and update_values is ok: @@ -973,7 +973,7 @@ def test_schema_fv3_namelist_update_values(fv3_prop): errors = fv3_prop("namelist", "properties", "update_values") # array, boolean, number, and string values are ok: assert not errors( - {"nml": {"array": [1, 2, 3], "bool": True, "int": 88, "float": 3.14, "string": "foo"}} + {"nml": {"array": [1, 2, 3], "bool": True, "int": 42, "float": 3.14, "string": "foo"}} ) # Other types are not, e.g.: assert "None is not of type 'array', 'boolean', 'number', 'string'\n" in errors( @@ -989,7 +989,7 @@ def test_schema_fv3_rundir(fv3_prop): errors = fv3_prop("rundir") # Must be a string: assert not errors("/some/path") - assert "88 is not of type 'string'\n" in errors(88) + assert "42 is not of type 'string'\n" in errors(42) # global-equiv-resol @@ -1016,7 +1016,7 @@ def test_schema_global_equiv_resol_paths(global_equiv_resol_prop, schema_entry): errors = global_equiv_resol_prop(schema_entry) # Must be a string: assert not errors("/some/path") - assert "88 is not of type 'string'\n" in errors(88) + assert "42 is not of type 'string'\n" in errors(42) # ioda @@ -1060,7 +1060,7 @@ def test_schema_ioda_rundir(ioda_prop): errors = ioda_prop("rundir") # Must be a string: assert not errors("/some/path") - assert "88 is not of type 'string'\n" in errors(88) + assert "42 is not of type 'string'\n" in errors(42) # jedi @@ -1104,7 +1104,7 @@ def test_schema_jedi_rundir(jedi_prop): errors = jedi_prop("rundir") # Must be a string: assert not errors("/some/path") - assert "88 is not of type 'string'\n" in errors(88) + assert "42 is not of type 'string'\n" in errors(42) # make-hgrid @@ -1166,7 +1166,7 @@ def test_schema_make_hgrid_rundir(make_hgrid_prop): errors = make_hgrid_prop("rundir") # Must be a string: assert not errors("/some/path") - assert "88 is not of type 'string'\n" in errors(88) + assert "42 is not of type 'string'\n" in errors(42) # make-solo-mosaic @@ -1195,7 +1195,7 @@ def test_schema_make_solo_mosaic_config(make_solo_mosaic_prop): assert f"'{key}' is a required property" in errors({}) # A string value is ok for dir: if key == "dir": - assert "not of type 'string'" in str(errors({key: 88})) + assert "not of type 'string'" in str(errors({key: 42})) # num_tiles must be an integer: else: assert "not of type 'integer'" in str(errors({key: "/path/"})) @@ -1209,7 +1209,7 @@ def test_schema_make_solo_mosaic_rundir(make_solo_mosaic_prop): errors = make_solo_mosaic_prop("rundir") # Must be a string: assert not errors("/some/path") - assert "88 is not of type 'string'\n" in errors(88) + assert "42 is not of type 'string'\n" in errors(42) # makedirs @@ -1267,7 +1267,7 @@ def test_schema_mpas_lateral_boundary_conditions(mpas_prop): assert "-1 is less than the minimum of 0" in errors(with_set(config, -1, "offset")) assert "'s' is not of type 'integer'\n" in errors(with_set(config, "s", "offset")) # path must be a string: - assert "88 is not of type 'string'\n" in errors(with_set(config, 88, "path")) + assert "42 is not of type 'string'\n" in errors(with_set(config, 42, "path")) def test_schema_mpas_length(mpas_prop): @@ -1289,7 +1289,7 @@ def test_schema_mpas_namelist(mpas_prop): # Just base_file is ok: assert not errors(base_file) # base_file must be a string: - assert "88 is not of type 'string'\n" in errors({"base_file": 88}) + assert "42 is not of type 'string'\n" in errors({"base_file": 42}) # Just update_values is ok: assert not errors(update_values) # A combination of base_file and update_values is ok: @@ -1302,7 +1302,7 @@ def test_schema_mpas_namelist_update_values(mpas_prop): errors = mpas_prop("namelist", "properties", "update_values") # array, boolean, number, and string values are ok: assert not errors( - {"nml": {"array": [1, 2, 3], "bool": True, "int": 88, "float": 3.14, "string": "foo"}} + {"nml": {"array": [1, 2, 3], "bool": True, "int": 42, "float": 3.14, "string": "foo"}} ) # Other types are not, e.g.: assert "None is not of type 'array', 'boolean', 'number', 'string'\n" in errors( @@ -1318,7 +1318,7 @@ def test_schema_mpas_rundir(mpas_prop): errors = mpas_prop("rundir") # Must be a string: assert not errors("/some/path") - assert "88 is not of type 'string'\n" in errors(88) + assert "42 is not of type 'string'\n" in errors(42) # mpas-init @@ -1363,7 +1363,7 @@ def test_schema_mpas_init_boundary_conditions(mpas_init_prop): assert "-1 is less than the minimum of 0" in errors(with_set(config, -1, "offset")) assert "'s' is not of type 'integer'\n" in errors(with_set(config, "s", "offset")) # path must be a string: - assert "88 is not of type 'string'\n" in errors(with_set(config, 88, "path")) + assert "42 is not of type 'string'\n" in errors(with_set(config, 42, "path")) # length must be a positive int assert "0 is less than the minimum of 1" in errors(with_set(config, 0, "length")) assert "-1 is less than the minimum of 1" in errors(with_set(config, -1, "length")) @@ -1377,7 +1377,7 @@ def test_schema_mpas_init_namelist(mpas_init_prop): # Just base_file is ok: assert not errors(base_file) # base_file must be a string: - assert "88 is not of type 'string'\n" in errors({"base_file": 88}) + assert "42 is not of type 'string'\n" in errors({"base_file": 42}) # Just update_values is ok: assert not errors(update_values) # A combination of base_file and update_values is ok: @@ -1390,7 +1390,7 @@ def test_schema_mpas_init_namelist_update_values(mpas_init_prop): errors = mpas_init_prop("namelist", "properties", "update_values") # array, boolean, number, and string values are ok: assert not errors( - {"nml": {"array": [1, 2, 3], "bool": True, "int": 88, "float": 3.14, "string": "foo"}} + {"nml": {"array": [1, 2, 3], "bool": True, "int": 42, "float": 3.14, "string": "foo"}} ) # Other types are not, e.g.: assert "None is not of type 'array', 'boolean', 'number', 'string'\n" in errors( @@ -1406,7 +1406,7 @@ def test_schema_mpas_init_rundir(mpas_init_prop): errors = mpas_init_prop("rundir") # Must be a string: assert not errors("/some/path") - assert "88 is not of type 'string'\n" in errors(88) + assert "42 is not of type 'string'\n" in errors(42) # mpas-streams @@ -1532,7 +1532,7 @@ def test_schema_namelist(): "array": [1, 2, 3], "boolean": True, "float": 3.14, - "integer": 88, + "integer": 42, "string": "foo", } } @@ -1716,7 +1716,7 @@ def test_schema_rocoto_metatask_attrs(): assert not errors({"mode": "serial"}) assert "'foo' is not one of ['parallel', 'serial']" in errors({"mode": "foo"}) # Positive int is ok for throttle: - assert not errors({"throttle": 88}) + assert not errors({"throttle": 42}) assert not errors({"throttle": 0}) assert "-1 is less than the minimum of 0" in errors({"throttle": -1}) assert "'foo' is not of type 'integer'\n" in errors({"throttle": "foo"}) @@ -1805,7 +1805,7 @@ def test_schema_schism_rundir(schism_prop): errors = schism_prop("rundir") # Must be a string: assert not errors("/some/path") - assert "88 is not of type 'string'\n" in errors(88) + assert "42 is not of type 'string'\n" in errors(42) # sfc-climo-gen @@ -1834,7 +1834,7 @@ def test_schema_sfc_climo_gen_namelist(sfc_climo_gen_prop): # Just base_file is ok: assert not errors(base_file) # base_file must be a string: - assert "88 is not of type 'string'\n" in errors({"base_file": 88}) + assert "42 is not of type 'string'\n" in errors({"base_file": 42}) # Just update_values is ok: assert not errors(update_values) # config is required with update_values: @@ -1848,7 +1848,7 @@ def test_schema_sfc_climo_gen_namelist(sfc_climo_gen_prop): def test_schema_sfc_climo_gen_namelist_update_values(sfc_climo_gen_prop): errors = sfc_climo_gen_prop("namelist", "properties", "update_values", "properties", "config") # array, boolean, number, and string values are ok: - assert not errors({"array": [1, 2, 3], "bool": True, "int": 88, "float": 3.14, "string": "foo"}) + assert not errors({"array": [1, 2, 3], "bool": True, "int": 42, "float": 3.14, "string": "foo"}) # Other types are not, e.g.: assert "None is not of type 'array', 'boolean', 'number', 'string'\n" in errors({"null": None}) # No minimum number of entries is required: @@ -1859,7 +1859,7 @@ def test_schema_sfc_climo_gen_rundir(sfc_climo_gen_prop): errors = sfc_climo_gen_prop("rundir") # Must be a string: assert not errors("/some/path") - assert "88 is not of type 'string'\n" in errors(88) + assert "42 is not of type 'string'\n" in errors(42) # shave @@ -1869,8 +1869,8 @@ def test_schema_shave(): config = { "config": { "input_grid_file": "/path/to/input_grid_file", - "nx": 88, - "ny": 88, + "nx": 42, + "ny": 42, "nh4": 1, }, "execution": {"executable": "shave"}, @@ -1894,7 +1894,7 @@ def test_schema_shave_config_properties(): assert f"'{key}' is a required property" in errors({}) # A string value is ok for input_grid_file: if key == "input_grid_file": - assert "not of type 'string'" in str(errors({key: 88})) + assert "not of type 'string'" in str(errors({key: 42})) # nx, ny, and nh4 must be positive integers: elif key in ["nx", "ny", "nh4"]: assert "not of type 'integer'" in str(errors({key: "/path/"})) @@ -1909,7 +1909,7 @@ def test_schema_shave_rundir(shave_prop): errors = shave_prop("rundir") # Must be a string: assert not errors("/some/path") - assert "88 is not of type 'string'\n" in errors(88) + assert "42 is not of type 'string'\n" in errors(42) # ungrib @@ -1941,7 +1941,7 @@ def test_schema_ungrib_rundir(ungrib_prop): errors = ungrib_prop("rundir") # Must be a string: assert not errors("/some/path") - assert "88 is not of type 'string'\n" in errors(88) + assert "42 is not of type 'string'\n" in errors(42) # upp @@ -2011,10 +2011,10 @@ def test_schema_upp_namelist(upp_prop): assert "too long" in errors( {"update_values": {"model_inputs": {key: "c" * (maxpathlen + 1)}}} ) - assert "not of type 'string'" in errors({"update_values": {"model_inputs": {key: 88}}}) + assert "not of type 'string'" in errors({"update_values": {"model_inputs": {key: 42}}}) # model_inputs: Only one grib value is supported: assert "not one of ['grib2']" in errors({"update_values": {"model_inputs": {"grib": "grib1"}}}) - assert "not of type 'string'" in errors({"update_values": {"model_inputs": {"grib": 88}}}) + assert "not of type 'string'" in errors({"update_values": {"model_inputs": {"grib": 42}}}) # model_inputs: Only certain ioform values are supported: assert "not one of ['binarynemsio', 'netcdf']" in errors( {"update_values": {"model_inputs": {"ioform": "jpg"}}} @@ -2047,15 +2047,15 @@ def test_schema_upp_namelist(upp_prop): "write_ifi_debug_files", ]: assert not errors({"update_values": {"nampgb": {key: True}}}) - assert "not of type 'boolean'" in errors({"update_values": {"nampgb": {key: 88}}}) + assert "not of type 'boolean'" in errors({"update_values": {"nampgb": {key: 42}}}) # nampgb: String pathnames have a max length: for key in ["filenameaer"]: assert not errors({"update_values": {"nampgb": {key: "c" * maxpathlen}}}) assert "too long" in errors({"update_values": {"nampgb": {key: "c" * (maxpathlen + 1)}}}) - assert "not of type 'string'" in errors({"update_values": {"nampgb": {key: 88}}}) + assert "not of type 'string'" in errors({"update_values": {"nampgb": {key: 42}}}) # nampgb: Some integer keys are supported: for key in ["kpo", "kpv", "kth", "numx"]: - assert not errors({"update_values": {"nampgb": {key: 88}}}) + assert not errors({"update_values": {"nampgb": {key: 42}}}) assert "not of type 'integer'" in errors({"update_values": {"nampgb": {key: True}}}) # nampgb: Some arrays of numbers are supported: nitems = 70 @@ -2077,7 +2077,7 @@ def test_schema_upp_rundir(upp_prop): errors = upp_prop("rundir") # Must be a string: assert not errors("/some/path") - assert "88 is not of type 'string'\n" in errors(88) + assert "42 is not of type 'string'\n" in errors(42) # ww3 @@ -2122,4 +2122,4 @@ def test_schema_ww3_rundir(ww3_prop): errors = ww3_prop("rundir") # Must be a string: assert not errors("/some/path") - assert "88 is not of type 'string'\n" in errors(88) + assert "42 is not of type 'string'\n" in errors(42) diff --git a/src/uwtools/tests/utils/test_api.py b/src/uwtools/tests/utils/test_api.py index 6e6123bab..e41d89d3b 100644 --- a/src/uwtools/tests/utils/test_api.py +++ b/src/uwtools/tests/utils/test_api.py @@ -26,7 +26,7 @@ def execute_kwargs(): } -@mark.parametrize("val", [Path("/some/path"), {"foo": 88}]) +@mark.parametrize("val", [Path("/some/path"), {"foo": 42}]) def test_ensure_data_source_passthrough(val): assert api.ensure_data_source(data_source=val, stdin_ok=False) == val diff --git a/src/uwtools/tests/utils/test_file.py b/src/uwtools/tests/utils/test_file.py index 63d9b322d..620932704 100644 --- a/src/uwtools/tests/utils/test_file.py +++ b/src/uwtools/tests/utils/test_file.py @@ -112,7 +112,7 @@ def test_resource_path(): assert file.resource_path().is_dir() -@mark.parametrize("val", [Path("/some/path"), {"foo": 88}]) +@mark.parametrize("val", [Path("/some/path"), {"foo": 42}]) def test_str2path_passthrough(val): assert file.str2path(val) == val