Skip to content

Commit bd8d892

Browse files
Save some lines in test files by excluding all generated_by by default
1 parent 11587e5 commit bd8d892

File tree

8 files changed

+12
-21
lines changed

8 files changed

+12
-21
lines changed

Diff for: scripts/diff_jsons.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
parser.add_argument("first_json", help="first JSON to compare")
1717
parser.add_argument("second_json", help="second JSON to compare")
1818
parser.add_argument("--significant-digits", type=int, default=5, help="number of significant digits to use when comparing numeric values")
19-
parser.add_argument("--exclude-paths", nargs="+", action=ExtendOverwriteDefault, help="list of paths to exclude from consideration when performing a diff", default=["root['generated_by']['version']", "root['meta']['updated']"])
19+
parser.add_argument("--exclude-paths", nargs="+", action=ExtendOverwriteDefault, help="list of paths to exclude from consideration when performing a diff", default=["root['generated_by']", "root['meta']['updated']"])
2020
parser.add_argument("--exclude-regex-paths", nargs="+", action="extend", help="list of path regular expressions to exclude from consideration when performing a diff")
2121
parser.add_argument("--ignore-numeric-type-changes", action="store_true", help="ignore numeric type changes in the diff (e.g., int of 1 to float of 1.0)")
2222

Diff for: tests/functional/ancestral/cram/case-sensitive.t

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ Change the _reference_ to lowercase
1515

1616
$ python3 "$TESTDIR/../../../../scripts/diff_jsons.py" \
1717
> "$TESTDIR/../data/simple-genome/nt_muts.ref-seq.json" \
18-
> "nt_muts.ref-seq.json" \
19-
> --exclude-paths "root['generated_by']"
18+
> "nt_muts.ref-seq.json"
2019
{}
2120

2221

@@ -37,6 +36,5 @@ be lowecase which will be compared against the uppercase reference
3736

3837
$ python3 "$TESTDIR/../../../../scripts/diff_jsons.py" \
3938
> "$TESTDIR/../data/simple-genome/nt_muts.ref-seq.json" \
40-
> "nt_muts.ref-seq.json" \
41-
> --exclude-paths "root['generated_by']"
39+
> "nt_muts.ref-seq.json"
4240
{}

Diff for: tests/functional/ancestral/cram/general.t

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ node-data JSON we diff against.
1919

2020
$ python3 "$TESTDIR/../../../../scripts/diff_jsons.py" \
2121
> "$TESTDIR/../data/simple-genome/nt_muts.ref-seq.json" \
22-
> "nt_muts.ref-seq.json" \
23-
> --exclude-paths "root['generated_by']"
22+
> "nt_muts.ref-seq.json"
2423
{}
2524

2625
Same as above but without providing a `--root-sequence`. The effect of this on behaviour is:
@@ -39,6 +38,5 @@ mutations (as there's nothing to compare the root node to)
3938

4039
$ python3 "$TESTDIR/../../../../scripts/diff_jsons.py" \
4140
> "$TESTDIR/../data/simple-genome/nt_muts.no-ref-seq.json" \
42-
> "nt_muts.no-ref-seq.json" \
43-
> --exclude-paths "root['generated_by']"
41+
> "nt_muts.no-ref-seq.json"
4442
{}

Diff for: tests/functional/clades/cram/membership-and-label.t

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@ Test custom membership key + label key. The only change should be the key names
1313

1414
$ cat clades_custom.json | sed "s/lineage/clade_membership/" | sed "s/origin/clade/" > clades_sed.json
1515

16-
$ python3 "$TESTDIR/../../../../scripts/diff_jsons.py" "$TESTDIR/../data/clades.json" clades_sed.json \
17-
> --exclude-paths "root['generated_by']"
16+
$ python3 "$TESTDIR/../../../../scripts/diff_jsons.py" "$TESTDIR/../data/clades.json" clades_sed.json
1817
{}

Diff for: tests/functional/clades/cram/no-label.t

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ Test the ability to _not_ export a branch label (same logic as not exporting the
1111
> --label-name none \
1212
> --output-node-data clades_no-labels.json &>/dev/null
1313

14-
$ python3 "$TESTDIR/../../../../scripts/diff_jsons.py" "$TESTDIR/../data/clades.json" clades_no-labels.json \
15-
> --exclude-paths "root['generated_by']"
14+
$ python3 "$TESTDIR/../../../../scripts/diff_jsons.py" "$TESTDIR/../data/clades.json" clades_no-labels.json
1615
{'dictionary_item_removed': [root['branches']]}

Diff for: tests/functional/clades/cram/root-clade-identification.t

+3-6
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ This is an oversight and ideally would be fixed
1212
> --clades "$TESTDIR/../data/toy_clades_nuc.tsv" \
1313
> --output-node-data toy_clades_1.json &>/dev/null
1414

15-
$ python3 "$TESTDIR/../../../../scripts/diff_jsons.py" "$TESTDIR/../data/toy_clades_1.json" toy_clades_1.json \
16-
> --exclude-paths "root['generated_by']"
15+
$ python3 "$TESTDIR/../../../../scripts/diff_jsons.py" "$TESTDIR/../data/toy_clades_1.json" toy_clades_1.json
1716
{}
1817

1918
A clade which exists at the root is identified (and correctly propogated) if the root sequence
@@ -25,8 +24,7 @@ is explicitly set.
2524
> --clades "$TESTDIR/../data/toy_clades_nuc.tsv" \
2625
> --output-node-data toy_clades_2a.json &>/dev/null
2726

28-
$ python3 "$TESTDIR/../../../../scripts/diff_jsons.py" "$TESTDIR/../data/toy_clades_2.json" toy_clades_2a.json \
29-
> --exclude-paths "root['generated_by']"
27+
$ python3 "$TESTDIR/../../../../scripts/diff_jsons.py" "$TESTDIR/../data/toy_clades_2.json" toy_clades_2a.json
3028
{}
3129

3230
A clade which exists at the root is identified (and correctly propogated) without a root sequence
@@ -38,6 +36,5 @@ if the (branch leading to the) root has the clade-defining mutation.
3836
> --clades "$TESTDIR/../data/toy_clades_nuc.tsv" \
3937
> --output-node-data toy_clades_2b.json &>/dev/null
4038

41-
$ python3 "$TESTDIR/../../../../scripts/diff_jsons.py" "$TESTDIR/../data/toy_clades_2.json" toy_clades_2b.json \
42-
> --exclude-paths "root['generated_by']"
39+
$ python3 "$TESTDIR/../../../../scripts/diff_jsons.py" "$TESTDIR/../data/toy_clades_2.json" toy_clades_2b.json
4340
{}

Diff for: tests/functional/refine/cram/not-timetree-mutations-per-site.t

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ Confirm that trees match expected topology and branch lengths, given that the ou
2828
> "$TESTDIR/../data/mutations_per_site_branch_lengths.json" \
2929
> branch_lengths.json \
3030
> --significant-digits 0 \
31-
> --exclude-paths "root['generated_by']['version']" "root['input_tree']"
31+
> --exclude-paths "generated_by" "input_tree"
3232
{}

Diff for: tests/functional/refine/cram/not-timetree-mutations.t

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ Confirm that trees match expected topology and branch lengths, given that the ou
2929
> "$TESTDIR/../data/integer_branch_lengths.json" \
3030
> branch_lengths.json \
3131
> --significant-digits 0 \
32-
> --exclude-paths "root['generated_by']['version']" "root['input_tree']" "root['alignment']"
32+
> --exclude-paths "generated_by" "input_tree" "alignment"
3333
{}

0 commit comments

Comments
 (0)