def _ensure_schema_out(self, data): if data is not None and isinstance(data, dict): if arr_eq(data.keys(), self.schema_out.keys()): return data raise SchemaException( message='data %r does not conform to output schema' % data)
def test_arr_eq_equal(): a = [1, 2, 3] b = [1, 2, 3] ok = utils.arr_eq(a, b) assert ok
def test_arr_eq_one_empty(): a = [1, 2, 3] b = [] ok = utils.arr_eq(a, b) assert not ok
def test_arr_eq_not_equal(): a = [1, 2, 3] b = [1, 2, 4] ok = utils.arr_eq(a, b) assert not ok
def test_arr_eq_empty_arrays(): a = [] b = [] ok = utils.arr_eq(a, b) assert not ok