From 26017ad988a47887f1767dd8992a119ae5a8d188 Mon Sep 17 00:00:00 2001 From: Nick Crews Date: Thu, 6 Jun 2024 09:12:29 -0800 Subject: [PATCH] test(refactor): simplify expr/test_literal.py Preparing for https://github.com/ibis-project/ibis/pull/8666 --- ibis/tests/expr/test_literal.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/ibis/tests/expr/test_literal.py b/ibis/tests/expr/test_literal.py index da056ff140f6..0893a7eec4bc 100644 --- a/ibis/tests/expr/test_literal.py +++ b/ibis/tests/expr/test_literal.py @@ -118,14 +118,13 @@ def test_struct_literal(value): @pytest.mark.parametrize( "value", [ - dict(field1="value1", field3=3.14), # wrong field name - dict(field1="value1"), # missing field + pytest.param(dict(field1="value1", field3=3.14), id="wrong_field"), + pytest.param(dict(field1="value1"), id="missing_field"), ], ) def test_struct_literal_non_castable(value): - typestr = "struct" with pytest.raises(TypeError, match="Unable to normalize"): - ibis.struct(value, type=typestr) + ibis.struct(value, type="struct") def test_struct_cast_to_empty_struct(): @@ -133,18 +132,11 @@ def test_struct_cast_to_empty_struct(): assert value.type().castable(dt.Struct({})) -@pytest.mark.parametrize( - "value", - [ - dict(key1="value1", key2="value2"), - ], -) -def test_map_literal(value): - typestr = "map" +def test_map_literal(): a = ibis.map(["a", "b"], [1, 2]) assert a.op().keys.value == ("a", "b") assert a.op().values.value == (1, 2) - assert a.type() == dt.dtype(typestr) + assert a.type() == dt.dtype("map") @pytest.mark.parametrize(