From 29d07aa5f1a2c07974449ec8335f01ad5591b619 Mon Sep 17 00:00:00 2001 From: Romain Dorgueil Date: Sun, 2 Jun 2019 16:43:11 +0200 Subject: [PATCH] Adds unit test for SetFields (fixes #341). --- tests/nodes/test_basics.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/nodes/test_basics.py b/tests/nodes/test_basics.py index 7cbdcb4..1011dd3 100644 --- a/tests/nodes/test_basics.py +++ b/tests/nodes/test_basics.py @@ -142,3 +142,14 @@ def test_map_fields_error(): context.write_sync(tuple()) assert context.status == "!" assert context.defunct + + +def test_set_fields(): + with BufferingNodeExecutionContext(bonobo.SetFields(["x", "y"])) as context: + context.write_sync((1, 2)) + + output = context.get_buffer() + assert len(output) == 1 + assert output[0]._fields == ("x", "y") + assert output[0].x == 1 + assert output[0].y == 2