From f268771600d4bcdc1b0b1c64183b26685bbfb11d Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Tue, 24 Oct 2017 03:50:45 +0900 Subject: [PATCH] Record constructors bacame to take only keywords See also https://github.com/spoqa/nirum/pull/165 --- tests/conftest.py | 5 +++-- tests/serialize_test.py | 14 ++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 8fa98b0..a834193 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -20,7 +20,8 @@ def fx_record_type(): @fixture def fx_point(fx_record_type, fx_unboxed_type): - return fx_record_type(fx_unboxed_type(3.14), fx_unboxed_type(1.592)) + return fx_record_type(left=fx_unboxed_type(3.14), + top=fx_unboxed_type(1.592)) @fixture @@ -35,7 +36,7 @@ def fx_rectangle_type(): @fixture def fx_rectangle(fx_rectangle_type, fx_point): - return fx_rectangle_type(fx_point, fx_point) + return fx_rectangle_type(upper_left=fx_point, lower_right=fx_point) @fixture diff --git a/tests/serialize_test.py b/tests/serialize_test.py index 1d9a3ad..6621b5a 100644 --- a/tests/serialize_test.py +++ b/tests/serialize_test.py @@ -29,14 +29,14 @@ def test_serialize_record_type(fx_point): def test_serialize_union_type(fx_point, fx_offset, fx_circle_type, fx_rectangle_type): - circle = fx_circle_type(fx_point, fx_offset) + circle = fx_circle_type(origin=fx_point, radius=fx_offset) s = { '_type': 'shape', '_tag': 'circle', 'origin': serialize_record_type(fx_point), 'radius': serialize_unboxed_type(fx_offset) } assert serialize_union_type(circle) == s - rectangle = fx_rectangle_type(fx_point, fx_point) + rectangle = fx_rectangle_type(upper_left=fx_point, lower_right=fx_point) s = { '_type': 'shape', '_tag': 'rectangle', 'upper_left': serialize_record_type(fx_point), @@ -93,8 +93,9 @@ def test_serialize_meta_set(d, expect): def test_serialize_meta_list(fx_record_type, fx_unboxed_type, fx_offset): - record = fx_record_type(fx_offset, fx_offset) - record2 = fx_record_type(fx_unboxed_type(1.1), fx_unboxed_type(1.2)) + record = fx_record_type(left=fx_offset, top=fx_offset) + record2 = fx_record_type(left=fx_unboxed_type(1.1), + top=fx_unboxed_type(1.2)) serialize_result = serialize_meta([record, record2]) assert serialize_result == [ {'_type': 'point', 'x': 1.2, 'top': 1.2}, @@ -105,8 +106,9 @@ def test_serialize_meta_list(fx_record_type, fx_unboxed_type, fx_offset): def test_serialize_meta_set_of_record(fx_record_type, fx_unboxed_type, fx_offset): - record = fx_record_type(fx_offset, fx_offset) - record2 = fx_record_type(fx_unboxed_type(1.1), fx_unboxed_type(1.2)) + record = fx_record_type(left=fx_offset, top=fx_offset) + record2 = fx_record_type(left=fx_unboxed_type(1.1), + top=fx_unboxed_type(1.2)) serialize_result = serialize_meta({record, record2}) assert record.__nirum_serialize__() in serialize_result assert record2.__nirum_serialize__() in serialize_result