diff --git a/tests/samples/empty.py b/tests/samples/empty.py index 3724ae1..521e1bf 100644 --- a/tests/samples/empty.py +++ b/tests/samples/empty.py @@ -7,16 +7,13 @@ def get_current_directory(): return Path(__file__).absolute().parent -def data(): - # Yes, I'm serious. This is equivalently 'default behaviour'. - metadata = scrivid.Metadata( - fps=12, - video_name="testSampleResult_\'empty\'", - window_size=(500, 500) - ) +def ALL(): + return INSTRUCTIONS(), METADATA() + +def INSTRUCTIONS(): directory = get_current_directory().parent / "images" - instructions = [ + return ( # This is a cheat to prevent the video from being one frame. Ideally, # I'd just return an empty list or only have a list with an element # that forces an extended length of the video. @@ -30,6 +27,12 @@ def data(): ), scrivid.HideAdjustment("HIDDEN", 0), scrivid.MoveAdjustment("HIDDEN", 1, scrivid.Properties(x=1), 11) - ] + ) - return instructions, metadata + +def METADATA(): + return scrivid.Metadata( + fps=12, + video_name="testSampleResult_\'empty\'", + window_size=(500, 500) + ) diff --git a/tests/samples/figure_eight.py b/tests/samples/figure_eight.py index 31ccba2..9be1684 100644 --- a/tests/samples/figure_eight.py +++ b/tests/samples/figure_eight.py @@ -7,15 +7,13 @@ def get_current_directory(): return Path(__file__).absolute().parent -def data(): - metadata = scrivid.Metadata( - fps=12, - video_name="testSampleResult_\'figure_eight\'", - window_size=(1356, 856) - ) +def ALL(): + return INSTRUCTIONS(), METADATA() + +def INSTRUCTIONS(): directory = get_current_directory().parent / "images" - instructions = [ + return ( scrivid.create_image_reference( "BLOCK", directory / "img3.png", @@ -30,6 +28,12 @@ def data(): scrivid.MoveAdjustment("BLOCK", 26, scrivid.Properties(x=-500, y=500), 10), scrivid.MoveAdjustment("BLOCK", 36, scrivid.Properties(x=-250, y=-250), 5), scrivid.MoveAdjustment("BLOCK", 41, scrivid.Properties(x=250, y=-250), 5) - ] + ) - return instructions, metadata + +def METADATA(): + return scrivid.Metadata( + fps=12, + video_name="testSampleResult_\'figure_eight\'", + window_size=(1356, 856) + ) diff --git a/tests/samples/image_drawing.py b/tests/samples/image_drawing.py index 69760ca..a36ec9a 100644 --- a/tests/samples/image_drawing.py +++ b/tests/samples/image_drawing.py @@ -7,15 +7,13 @@ def get_current_directory(): return Path(__file__).absolute().parent -def data(): - metadata = scrivid.Metadata( - fps=12, - video_name="testSampleResult_\'image_drawing\'", - window_size=(660, 660) - ) +def ALL(): + return INSTRUCTIONS(), METADATA() + +def INSTRUCTIONS(): directory = get_current_directory().parent / "images" - instructions = [ + return ( scrivid.create_image_reference( "TL", directory / "img1.png", @@ -63,6 +61,12 @@ def data(): ), scrivid.HideAdjustment("HIDDEN", 0), scrivid.ShowAdjustment("HIDDEN", 20) - ] + ) - return instructions, metadata + +def METADATA(): + return scrivid.Metadata( + fps=12, + video_name="testSampleResult_\'image_drawing\'", + window_size=(660, 660) + ) diff --git a/tests/samples/overlap.py b/tests/samples/overlap.py index ebbdafa..41d2d42 100644 --- a/tests/samples/overlap.py +++ b/tests/samples/overlap.py @@ -7,15 +7,13 @@ def get_current_directory(): return Path(__file__).absolute().parent -def data(): - metadata = scrivid.Metadata( - fps=12, - video_name="testSampleResult_\'overlap\'", - window_size=(410, 410) - ) +def ALL(): + return INSTRUCTIONS(), METADATA() + +def INSTRUCTIONS(): directory = get_current_directory().parent / "images" - instructions = [ + return ( scrivid.create_image_reference( "LEFT", directory / "img2.png", @@ -33,6 +31,12 @@ def data(): y=100 ), scrivid.MoveAdjustment("RIGHT", 12, scrivid.Properties(x=0), 1) - ] + ) - return instructions, metadata + +def METADATA(): + return scrivid.Metadata( + fps=12, + video_name="testSampleResult_\'overlap\'", + window_size=(410, 410) + ) diff --git a/tests/samples/slide.py b/tests/samples/slide.py index 74f8f43..e8bfb2f 100644 --- a/tests/samples/slide.py +++ b/tests/samples/slide.py @@ -7,15 +7,13 @@ def get_current_directory(): return Path(__file__).absolute().parent -def data(): - metadata = scrivid.Metadata( - fps=12, - video_name="testSampleResult_\'slide\'", - window_size=(600, 306) - ) +def ALL(): + return INSTRUCTIONS(), METADATA() + +def INSTRUCTIONS(): directory = get_current_directory().parent / "images" - instructions = [ + return ( scrivid.create_image_reference( "stone", directory / "img2.png", @@ -25,6 +23,12 @@ def data(): y=20 ), scrivid.MoveAdjustment("stone", 1, scrivid.Properties(x=500), 36) - ] + ) - return instructions, metadata + +def METADATA(): + return scrivid.Metadata( + fps=12, + video_name="testSampleResult_\'slide\'", + window_size=(600, 306) + ) diff --git a/tests/test_motion_tree.py b/tests/test_motion_tree.py index 2da47da..7bf87e9 100644 --- a/tests/test_motion_tree.py +++ b/tests/test_motion_tree.py @@ -53,7 +53,7 @@ def test_dump(indent, sample_module, expected_string_raw): .replace(r"{\b}", "\n" if indent else "") ) - instructions, _ = sample_module.data() + instructions = sample_module.INSTRUCTIONS() parsed_motion_tree = motion_tree.parse(instructions) actual = motion_tree.dump(parsed_motion_tree, indent=indent) @@ -138,7 +138,7 @@ def test_nodes_inheritance(node_cls, args): @categorize(category="motion_tree") @pytest_parametrize("sample_module", [empty, figure_eight, image_drawing]) def test_parse(sample_module): - instructions, _ = sample_module.data() + instructions = sample_module.INSTRUCTIONS() motion_tree.parse(instructions) @@ -172,7 +172,7 @@ def test_parse_duplicate_id(): motion_tree.InvokePrevious, motion_tree.End]) ]) def test_walk(sample_module, expected_node_order): - instructions, _ = sample_module.data() + instructions = sample_module.INSTRUCTIONS() parsed_motion_tree = motion_tree.parse(instructions) for actual, expected_node in zip(motion_tree.walk(parsed_motion_tree), expected_node_order): actual_node = type(actual) diff --git a/tests/test_videos.py b/tests/test_videos.py index 547074b..ad1bd8f 100644 --- a/tests/test_videos.py +++ b/tests/test_videos.py @@ -74,7 +74,7 @@ def __exit__(self, *_): (slide, "slide") ]) def test_compile_video_output(temp_dir, sample_function, sample_module_name): - instructions, metadata = sample_function.data() + instructions, metadata = sample_function.ALL() metadata.save_location = temp_dir scrivid.compile_video(instructions, metadata)