# contribution. # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. # # END HEADER from __future__ import division, print_function, absolute_import import hypothesis.strategies as st import hypothesis.extra.pandas as pdst from tests.common.arguments import e, argument_validation_test BAD_ARGS = [ e(pdst.data_frames), e(pdst.data_frames, pdst.columns(1, dtype='not a dtype')), e(pdst.data_frames, pdst.columns(1, elements='not a strategy')), e(pdst.data_frames, pdst.columns([[]])), e(pdst.data_frames, [], index=[]), e(pdst.data_frames, [], rows=st.fixed_dictionaries({'A': st.just(1)})), e(pdst.data_frames, pdst.columns(1)), e(pdst.data_frames, pdst.columns(1, dtype=float, fill=1)), e(pdst.data_frames, pdst.columns(1, dtype=float, elements=1)), e(pdst.data_frames, pdst.columns(1, fill=1, dtype=float)), e(pdst.data_frames, pdst.columns(['A', 'A'], dtype=float)), e(pdst.data_frames, pdst.columns(1, elements=st.none(), dtype=int)), e(pdst.data_frames, 1), e(pdst.data_frames, [1]), e(pdst.data_frames, pdst.columns(1, dtype='category')), e(pdst.data_frames,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at https://mozilla.org/MPL/2.0/. # # END HEADER from datetime import datetime import pandas as pd import hypothesis.extra.pandas as pdst import hypothesis.strategies as st from hypothesis import given from tests.common.arguments import argument_validation_test, e BAD_ARGS = [ e(pdst.data_frames), e(pdst.data_frames, pdst.columns(1, dtype="not a dtype")), e(pdst.data_frames, pdst.columns(1, elements="not a strategy")), e(pdst.data_frames, pdst.columns([[]])), e(pdst.data_frames, [], index=[]), e(pdst.data_frames, [], rows=st.fixed_dictionaries({"A": st.just(1)})), e(pdst.data_frames, pdst.columns(1)), e(pdst.data_frames, pdst.columns(1, dtype=float, fill=1)), e(pdst.data_frames, pdst.columns(1, dtype=float, elements=1)), e(pdst.data_frames, pdst.columns(1, fill=1, dtype=float)), e(pdst.data_frames, pdst.columns(["A", "A"], dtype=float)), e(pdst.data_frames, pdst.columns(1, elements=st.none(), dtype=int)), e(pdst.data_frames, 1), e(pdst.data_frames, [1]), e(pdst.data_frames, pdst.columns(1, dtype="category")), e(
import hypothesis.strategies as st from tests.common.arguments import argument_validation_test, e BAD_ARGS = [] def adjust(ex, **kwargs): f, a, b = ex b = dict(b) b.update(kwargs) BAD_ARGS.append((f, a, b)) for ex in [ e(st.lists, st.integers()), e(st.sets, st.integers()), e(st.frozensets, st.integers()), e(st.dictionaries, st.integers(), st.integers()), e(st.text), e(st.binary), ]: adjust(ex, min_size=-1) adjust(ex, max_size=-1) adjust(ex, min_size="no") adjust(ex, max_size="no") BAD_ARGS.extend([e(st.lists, st.nothing(), unique=True, min_size=1)]) test_raise_invalid_argument = argument_validation_test(BAD_ARGS)
# contribution. # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at https://mozilla.org/MPL/2.0/. # # END HEADER from __future__ import absolute_import, division, print_function import hypothesis.extra.pandas as pdst import hypothesis.strategies as st from tests.common.arguments import argument_validation_test, e BAD_ARGS = [ e(pdst.data_frames), e(pdst.data_frames, pdst.columns(1, dtype="not a dtype")), e(pdst.data_frames, pdst.columns(1, elements="not a strategy")), e(pdst.data_frames, pdst.columns([[]])), e(pdst.data_frames, [], index=[]), e(pdst.data_frames, [], rows=st.fixed_dictionaries({"A": st.just(1)})), e(pdst.data_frames, pdst.columns(1)), e(pdst.data_frames, pdst.columns(1, dtype=float, fill=1)), e(pdst.data_frames, pdst.columns(1, dtype=float, elements=1)), e(pdst.data_frames, pdst.columns(1, fill=1, dtype=float)), e(pdst.data_frames, pdst.columns(["A", "A"], dtype=float)), e(pdst.data_frames, pdst.columns(1, elements=st.none(), dtype=int)), e(pdst.data_frames, 1), e(pdst.data_frames, [1]), e(pdst.data_frames, pdst.columns(1, dtype="category")), e(
import hypothesis.strategies as st from tests.common.arguments import e, argument_validation_test BAD_ARGS = [] def adjust(ex, **kwargs): f, a, b = ex b = dict(b) b.update(kwargs) BAD_ARGS.append((f, a, b)) for ex in [ e(st.lists, st.integers()), e(st.sets, st.integers()), e(st.frozensets, st.integers()), e(st.dictionaries, st.integers(), st.integers()), e(st.text), e(st.binary) ]: adjust(ex, average_size=10, max_size=9), adjust(ex, average_size=10, min_size=11), adjust(ex, min_size=-1) adjust(ex, average_size=-1) adjust(ex, max_size=-1) adjust(ex, min_size='no') adjust(ex, average_size='no') adjust(ex, max_size='no')