From 871603dcedc36de0a6e68864d73f7ce203c98dcd Mon Sep 17 00:00:00 2001 From: mkp Date: Wed, 28 Jan 2026 11:33:15 +0100 Subject: [PATCH 1/2] Simplify test script --- maxdiff/tests/test.py | 127 ++++++++---------------------------------- 1 file changed, 23 insertions(+), 104 deletions(-) diff --git a/maxdiff/tests/test.py b/maxdiff/tests/test.py index 7ffeecd..89219ce 100644 --- a/maxdiff/tests/test.py +++ b/maxdiff/tests/test.py @@ -1,123 +1,42 @@ -# Tests if the content of the test scripts is equal to the result of the conversion scripts. +# Tests if the contents of the stored textual representations (the baselines) +# are still equal to the results of the maxdiff conversion script. # If not, displays the diff between the two. -import sys import unittest -from io import StringIO from unittest.mock import patch import os.path from test_parse import parse class TestStringMethods(unittest.TestCase): - def test_parse_device(self): + def test_all_parsing(self): self.maxDiff = None - expected_path, test_path = get_test_path_files("EncryptedTest.amxd") + files = [ + "Test.amxd", + "EncryptedTest.amxd", + "FrozenTest.amxd", + "Test.maxpat", + "PatcherWithLocalStyles.maxpat", + "/Test Project/Zipped.als", + "/Test Project/Test.als", + "MalFormedJsonTest.maxpat", + "ConflictMarkerTest.maxpat", + "WithGarbage.amxd", + ] - with open(expected_path, mode="r") as expected_file: - expected = expected_file.read() - actual = parse(test_path) - self.assertEqual(expected, actual) - - def test_parse_encrypted_device(self): - self.maxDiff = None - - expected_path, test_path = get_test_path_files("Test.amxd") - - with open(expected_path, mode="r") as expected_file: - expected = expected_file.read() - actual = parse(test_path) - self.assertEqual(expected, actual) - - def test_parse_frozen_device(self): - self.maxDiff = None - - expected_path, test_path = get_test_path_files("FrozenTest.amxd") - - with open(expected_path, mode="r") as expected_file: - expected = expected_file.read() - actual = parse(test_path) - self.assertEqual(expected, actual) - - def test_parse_maxpat(self): - self.maxDiff = None - - expected_path, test_path = get_test_path_files("Test.maxpat") - - with open(expected_path, mode="r") as expected_file: - expected = expected_file.read() - actual = parse(test_path) - - self.assertEqual(expected, actual) - - def test_parse_maxpat_with_styles(self): - self.maxDiff = None - expected_path, test_path = get_test_path_files("PatcherWithLocalStyles.maxpat") - - with open(expected_path, mode="r") as expected_file: - expected = expected_file.read() - actual = parse(test_path) - - self.assertEqual(expected, actual) - - def test_parse_als_zipped(self): - self.maxDiff = None - - expected_path, test_path = get_test_path_files("/Test Project/Zipped.als") - - with open(expected_path, mode="r") as expected_file: - expected = expected_file.read() - actual = parse(test_path) - self.assertEqual(expected, actual) - - def test_parse_als_unzipped(self): - self.maxDiff = None - - # result of an unzipped set should be same as a zipped set - expected_path, test_path = get_test_path_files("/Test Project/Test.als") - - with open(expected_path, mode="r") as expected_file: - expected = expected_file.read() - actual = parse(test_path) - self.assertEqual(expected, actual) - - def test_parse_malformed_maxpat(self): - self.maxDiff = None - - expected_path, test_path = get_test_path_files("MalFormedJsonTest.maxpat") + for file_name in files: + with self.subTest(file=file_name): + self.assertDiffsEqual(file_name) - with open(expected_path, mode="r") as expected_file: - expected = expected_file.read() - actual = parse(test_path) - self.assertEqual(expected, actual) - - def test_parse_maxpat_with_merge_conficts(self): - self.maxDiff = None - - expected_path, test_path = get_test_path_files("ConflictMarkerTest.maxpat") - - with open(expected_path, mode="r") as expected_file: - expected = expected_file.read() - actual = parse(test_path) - self.assertEqual(expected, actual) - - def test_parse_with_garbage(self): - self.maxDiff = None - - expected_path, test_path = get_test_path_files("WithGarbage.amxd") + def assertDiffsEqual(self, file_name): + test_path = get_test_path_file(f"test_files/{file_name}") + expected_path = get_test_path_file(f"test_baselines/{file_name}.txt") with open(expected_path, mode="r") as expected_file: expected = expected_file.read() - actual = parse(test_path) - self.assertEqual(expected, actual) - - -def get_test_path_files(file_name): - expected = get_test_path_file(f"test_baselines/{file_name}.txt") - test = get_test_path_file(f"test_files/{file_name}") - - return (expected, test) + actual = parse(test_path) + self.assertEqual(expected, actual) def get_test_path_file(file_name): From 916569da960f728694ef444a6b2b663508706947 Mon Sep 17 00:00:00 2001 From: mkp Date: Wed, 28 Jan 2026 11:26:35 +0100 Subject: [PATCH 2/2] Save tests in Max 9.0.10 --- .../tests/test_baselines/FrozenTest.amxd.txt | 6 ++-- maxdiff/tests/test_baselines/Test.amxd.txt | 12 +++---- maxdiff/tests/test_baselines/Test.maxpat.txt | 2 +- maxdiff/tests/test_files/FrozenTest.amxd | Bin 411119 -> 409862 bytes maxdiff/tests/test_files/MyAbstraction.maxpat | 32 ++--------------- .../tests/test_files/ParamAbstraction.maxpat | 33 +++--------------- maxdiff/tests/test_files/Test.amxd | Bin 36497 -> 36341 bytes maxdiff/tests/test_files/Test.maxpat | 32 ++--------------- 8 files changed, 19 insertions(+), 98 deletions(-) diff --git a/maxdiff/tests/test_baselines/FrozenTest.amxd.txt b/maxdiff/tests/test_baselines/FrozenTest.amxd.txt index f9afad0..715473a 100644 --- a/maxdiff/tests/test_baselines/FrozenTest.amxd.txt +++ b/maxdiff/tests/test_baselines/FrozenTest.amxd.txt @@ -2,9 +2,9 @@ MIDI Effect Device ------------------- Device is frozen ----- Contents ----- -Test.amxd: 36528 bytes, modified at 2025/06/26 12:53:53 UTC <= Device -ParamAbstraction.maxpat: 1570 bytes, modified at 2024/05/24 13:59:36 UTC, 2 instances -MyAbstraction.maxpat: 2015 bytes, modified at 2025/02/14 11:10:38 UTC, 6 instances +Test.amxd: 36531 bytes, modified at 2026/01/28 10:27:01 UTC <= Device +ParamAbstraction.maxpat: 956 bytes, modified at 2026/01/28 10:25:56 UTC, 2 instances +MyAbstraction.maxpat: 1369 bytes, modified at 2026/01/28 10:26:01 UTC, 6 instances AbstractionWithParameter.maxpat: 1569 bytes, modified at 2024/05/24 13:59:36 UTC, 2 instances hz-icon.svg: 484 bytes, modified at 2024/05/24 13:59:36 UTC, 3 instances beat-icon.svg: 533 bytes, modified at 2024/05/24 13:59:36 UTC, 3 instances diff --git a/maxdiff/tests/test_baselines/Test.amxd.txt b/maxdiff/tests/test_baselines/Test.amxd.txt index 15cfe92..c800dd2 100644 --- a/maxdiff/tests/test_baselines/Test.amxd.txt +++ b/maxdiff/tests/test_baselines/Test.amxd.txt @@ -22,12 +22,10 @@ dependency_cache: {'name': 'TestScript.js', 'bootpath': '~/maxdevtools/maxdiff/tests/test_files', 'type': 'TEXT', 'implicit': 1} {'name': 'VisibleBang.js', 'bootpath': '~/maxdevtools/maxdiff/tests/test_files', 'type': 'TEXT', 'implicit': 1} {'name': 'beat-icon.svg', 'bootpath': '~/maxdevtools/maxdiff/tests/test_files', 'type': 'svg', 'implicit': 1} - {'name': 'collContent.txt', 'bootpath': '~/maxdevtools/maxdiff/tests/test_files', 'type': 'TEXT', 'implicit': 1} {'name': 'fpic.png', 'bootpath': '~/maxdevtools/maxdiff/tests/test_files', 'type': 'PNG', 'implicit': 1} {'name': 'hz-icon.svg', 'bootpath': '~/maxdevtools/maxdiff/tests/test_files', 'type': 'svg', 'implicit': 1} {'name': 'my-maxnode-basic.js', 'bootpath': '~/maxdevtools/maxdiff/tests/test_files', 'type': 'TEXT', 'implicit': 1} {'name': 'myTestTable', 'bootpath': '~/maxdevtools/maxdiff/tests/test_files', 'type': 'TEXT', 'implicit': 1} - {'name': 'mystorage.json', 'bootpath': '~/maxdevtools/maxdiff/tests/test_files', 'type': 'JSON', 'implicit': 1} {'name': 'myxfade.genjit', 'bootpath': '~/maxdevtools/maxdiff/tests/test_files', 'type': 'gJIT', 'implicit': 1} {'name': 'shakerkicksnare.aif', 'bootpath': '~/maxdevtools/maxdiff/tests/test_files', 'type': 'AIFF', 'implicit': 1} {'name': 'times3.gendsp', 'bootpath': '~/maxdevtools/maxdiff/tests/test_files', 'type': 'gDSP', 'implicit': 1} @@ -39,7 +37,7 @@ project: collContent.txt ----------- patcher ----------- -appversion: 9.0.7-x64-1 | rect: [91, 153, 1288, 310] | openrect: [0, 0, 0, 169] | default_fontsize: 10.0 | default_fontname: Arial Bold | gridsize: [8, 8] | boxanimatetime: 500 | latency: 0 | is_mpe: 0 | external_mpe_tuning_enabled: 0 | platform_compatibility: 0 | autosave: 0 +appversion: 9.0.10-x64-1 | rect: [91, 153, 1288, 310] | openrect: [0, 0, 0, 169] | default_fontsize: 10.0 | default_fontname: Arial Bold | gridsize: [8, 8] | boxanimatetime: 500 | latency: 0 | is_mpe: 0 | external_mpe_tuning_enabled: 0 | platform_compatibility: 0 | autosave: 0 ----------- objects ----------- [comment NOTE: after any changes to this device, also update FrozenTest.amxd] [poly~ MyAbstraction] @@ -50,7 +48,7 @@ appversion: 9.0.7-x64-1 | rect: [91, 153, 1288, 310] | openrect: [0, 0, 0, 169] [coll] [p ImplicitDependencies] varname: ImplicitDependencies ----------- patcher ----------- - appversion: 9.0.7-x64-1 | rect: [60, 130, 639, 710] + appversion: 9.0.10-x64-1 | rect: [60, 130, 639, 710] ----------- objects ----------- [js TestScript] filename: TestScript | parameter_enable: 0 [comment We would expect implicit dependencies for these but they don't seem to be added.] bubble: 1 | bubbleside: 2 | linecount: 2 @@ -83,7 +81,7 @@ appversion: 9.0.7-x64-1 | rect: [91, 153, 1288, 310] | openrect: [0, 0, 0, 169] [message read myTestTable] (0) => (0) [table myTestTable] [bpatcher ThisWasAnAbstractionBeforeEmbeddingIt.maxpat] embed: 1 ----------- patcher ----------- - appversion: 9.0.7-x64-1 | rect: [927, 431, 640, 480] + appversion: 9.0.10-x64-1 | rect: [927, 431, 640, 480] ----------- objects ----------- [live.comment Embedded] [live.numbox] parameter: @@ -97,7 +95,7 @@ appversion: 9.0.7-x64-1 | rect: [91, 153, 1288, 310] | openrect: [0, 0, 0, 169] [button] [gen @t exponent] ----------- patcher ----------- - appversion: 9.0.7-x64-1 | classnamespace: dsp.gen | rect: [84, 144, 653, 641] + appversion: 9.0.10-x64-1 | classnamespace: dsp.gen | rect: [84, 144, 653, 641] ----------- objects ----------- [codebox] //============================================================ @@ -140,7 +138,7 @@ appversion: 9.0.7-x64-1 | rect: [91, 153, 1288, 310] | openrect: [0, 0, 0, 169] [coll @embed 1] coll_data: {'count': 2, 'data': [{'key': 0, 'value': ['test']}, {'key': 1, 'value': ['another', 'test']}]} | embed: 1 | precision: 6 [p MySubpatcher] ----------- patcher ----------- - appversion: 9.0.7-x64-1 | rect: [805, 282, 271, 250] + appversion: 9.0.10-x64-1 | rect: [805, 282, 271, 250] ----------- objects ----------- [live.dial] parameter: [t b b] diff --git a/maxdiff/tests/test_baselines/Test.maxpat.txt b/maxdiff/tests/test_baselines/Test.maxpat.txt index 94415ed..eb97347 100644 --- a/maxdiff/tests/test_baselines/Test.maxpat.txt +++ b/maxdiff/tests/test_baselines/Test.maxpat.txt @@ -1,5 +1,5 @@ ----------- patcher ----------- -appversion: 8.5.5-x64-1 | rect: [59, 106, 325, 253] | autosave: 0 +appversion: 9.0.10-x64-1 | rect: [59, 106, 325, 253] | autosave: 0 ----------- objects ----------- [button] [button] diff --git a/maxdiff/tests/test_files/FrozenTest.amxd b/maxdiff/tests/test_files/FrozenTest.amxd index 8b90116406c6b3ae80f59fdc45e7c1bef381f500..8b0db1c60f7dc6ca4df4720f740dcf987b7415f7 100644 GIT binary patch delta 482 zcmaFgE!oy2IYCC`nFAX`ZiPcK0|SEq5Hm2aS-DMqILC8hr81MD!SqHAHt)#?oH;gr z_{Ra{Pks*T+g z{gVSGFP!|}jeGL^>{*k`^Z2GmS+NOCo;GDGngJ6(a8EuvRS{%H^OPCwQ)Vy%F%u9o z12N0?DKl8VEo0m~z1yBmhvn(~DPO1Wwr8{BW8RaWW^4ou03HU0zQfbsJFqE$WVcM$ zb^ywmw(FGPjDD^P{ya|j1$AkXy0u54;dR(2qJRRAEXs5}4w delta 528 zcmZo`l6>DSIYCC`yek_+ZiPcK0|SEq5Hm2a+3Qa<$YC^}9M~VX@y}-tM)S=dIfbN+ z^72zsGL#go6qJ;7xH#cJDX$M9Ca>>T+%BcVwv1`|el<3Y$p_fDCqD?~ zoUW(N#y5Fi=9I~2CoJ6DH!+G4q(hm}2;|hs*^|-rOt;ry6Q6vbtgpFwN_+DZMj&Pa zVrC#_+1@;bRc;yMhUtr}*mPK)G<{B-e#wf>j*m?#Kh4+(7z{iN41EWt%UQE2Oz*N` zq@jT#Y}I z`WKK)8k7EK5N$HO%AU=L$;N&9I(xPxCR;OzAlRTF2cSWA7vLgBO!n$v>scO^`JMm( D@F=V} diff --git a/maxdiff/tests/test_files/MyAbstraction.maxpat b/maxdiff/tests/test_files/MyAbstraction.maxpat index 9bb3c77..bf73c54 100644 --- a/maxdiff/tests/test_files/MyAbstraction.maxpat +++ b/maxdiff/tests/test_files/MyAbstraction.maxpat @@ -2,42 +2,16 @@ "patcher" : { "fileversion" : 1, "appversion" : { - "major" : 8, - "minor" : 6, - "revision" : 2, + "major" : 9, + "minor" : 0, + "revision" : 10, "architecture" : "x64", "modernui" : 1 } , "classnamespace" : "box", "rect" : [ 312.0, 228.0, 221.0, 176.0 ], - "bglocked" : 0, - "openinpresentation" : 0, - "default_fontsize" : 12.0, - "default_fontface" : 0, - "default_fontname" : "Arial", - "gridonopen" : 1, "gridsize" : [ 15.0, 15.0 ], - "gridsnaponopen" : 1, - "objectsnaponopen" : 1, - "statusbarvisible" : 2, - "toolbarvisible" : 1, - "lefttoolbarpinned" : 0, - "toptoolbarpinned" : 0, - "righttoolbarpinned" : 0, - "bottomtoolbarpinned" : 0, - "toolbars_unpinned_last_save" : 0, - "tallnewobj" : 0, - "boxanimatetime" : 200, - "enablehscroll" : 1, - "enablevscroll" : 1, - "devicewidth" : 0.0, - "description" : "", - "digest" : "", - "tags" : "", - "style" : "", - "subpatcher_template" : "", - "assistshowspatchername" : 0, "boxes" : [ { "box" : { "id" : "obj-3", diff --git a/maxdiff/tests/test_files/ParamAbstraction.maxpat b/maxdiff/tests/test_files/ParamAbstraction.maxpat index c85f2c2..45171d7 100644 --- a/maxdiff/tests/test_files/ParamAbstraction.maxpat +++ b/maxdiff/tests/test_files/ParamAbstraction.maxpat @@ -2,42 +2,16 @@ "patcher" : { "fileversion" : 1, "appversion" : { - "major" : 8, - "minor" : 5, - "revision" : 5, + "major" : 9, + "minor" : 0, + "revision" : 10, "architecture" : "x64", "modernui" : 1 } , "classnamespace" : "box", "rect" : [ 192.0, 591.0, 640.0, 480.0 ], - "bglocked" : 0, - "openinpresentation" : 0, - "default_fontsize" : 12.0, - "default_fontface" : 0, - "default_fontname" : "Arial", - "gridonopen" : 1, "gridsize" : [ 15.0, 15.0 ], - "gridsnaponopen" : 1, - "objectsnaponopen" : 1, - "statusbarvisible" : 2, - "toolbarvisible" : 1, - "lefttoolbarpinned" : 0, - "toptoolbarpinned" : 0, - "righttoolbarpinned" : 0, - "bottomtoolbarpinned" : 0, - "toolbars_unpinned_last_save" : 0, - "tallnewobj" : 0, - "boxanimatetime" : 200, - "enablehscroll" : 1, - "enablevscroll" : 1, - "devicewidth" : 0.0, - "description" : "", - "digest" : "", - "tags" : "", - "style" : "", - "subpatcher_template" : "", - "assistshowspatchername" : 0, "boxes" : [ { "box" : { "id" : "obj-1", @@ -50,6 +24,7 @@ "saved_attribute_attributes" : { "valueof" : { "parameter_longname" : "InsideBpatcher", + "parameter_modmode" : 0, "parameter_shortname" : "live.dial", "parameter_type" : 0, "parameter_unitstyle" : 0 diff --git a/maxdiff/tests/test_files/Test.amxd b/maxdiff/tests/test_files/Test.amxd index f17b6d8844f49dc34e963708d83b810818050a96..df8df08fb833267e965307ff1443819921767970 100644 GIT binary patch delta 173 zcmbO@m+9+lrU^1kS9>SQ1X7bH#uaT2bW-aHr!;HoMz5H*}cPc^U2n`jGIk5V%Y$d^*Dk6 delta 120 zcmex5n`z=)rU^1kg?$s{@)*rG_62e>ns0u{DI~qwNL59S(R}hl&Z5nyoaga^nbDh% z2J%6eMVsB@c@#HKXt>V8mz^j1SAp5l`HqQvx6 Ty{zK=yvYvD4V$O6$Fl(dS=TJ~ diff --git a/maxdiff/tests/test_files/Test.maxpat b/maxdiff/tests/test_files/Test.maxpat index cf4a404..26df75c 100644 --- a/maxdiff/tests/test_files/Test.maxpat +++ b/maxdiff/tests/test_files/Test.maxpat @@ -2,42 +2,16 @@ "patcher" : { "fileversion" : 1, "appversion" : { - "major" : 8, - "minor" : 5, - "revision" : 5, + "major" : 9, + "minor" : 0, + "revision" : 10, "architecture" : "x64", "modernui" : 1 } , "classnamespace" : "box", "rect" : [ 59.0, 106.0, 325.0, 253.0 ], - "bglocked" : 0, - "openinpresentation" : 0, - "default_fontsize" : 12.0, - "default_fontface" : 0, - "default_fontname" : "Arial", - "gridonopen" : 1, "gridsize" : [ 15.0, 15.0 ], - "gridsnaponopen" : 1, - "objectsnaponopen" : 1, - "statusbarvisible" : 2, - "toolbarvisible" : 1, - "lefttoolbarpinned" : 0, - "toptoolbarpinned" : 0, - "righttoolbarpinned" : 0, - "bottomtoolbarpinned" : 0, - "toolbars_unpinned_last_save" : 0, - "tallnewobj" : 0, - "boxanimatetime" : 200, - "enablehscroll" : 1, - "enablevscroll" : 1, - "devicewidth" : 0.0, - "description" : "", - "digest" : "", - "tags" : "", - "style" : "", - "subpatcher_template" : "", - "assistshowspatchername" : 0, "boxes" : [ { "box" : { "id" : "obj-3",