From 066273c51a84bc4f1a915cf3d611b48ffdedab64 Mon Sep 17 00:00:00 2001 From: athossampayo Date: Mon, 19 Oct 2020 17:44:05 -0300 Subject: [PATCH] Added ValueError testing for util.table_apply as asked in issue #476 Added ValueError testing for util.table_apply as asked in issue #476 --- tests/test_util.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_util.py b/tests/test_util.py index e244ef256..a848a62c5 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -3,6 +3,7 @@ import datascience as ds from datascience import util import numpy as np +import pytest def test_doctests(): results = doctest.testmod(util, optionflags=doctest.NORMALIZE_WHITESPACE) @@ -50,6 +51,10 @@ def test_table_apply(): assert all(newtab['a'] == tab['a']) assert all(newtab['b'] == tab['b'] + 1) + with pytest.raises(ValueError) as err: + util.table_apply(tab, lambda a: a+1, subset=['b', 'd']) + assert "Colum mismatch: ['d']" in str(err.value) + def _round_eq(a, b): if hasattr(a, '__len__'):