예제 #1
0
    def test_from_string_ok(self, s, expected):
        all_types = {"sö": pa.string(), "bö": pa.bool_(), "iö": pa.int16()}
        actual = Conjunction.from_string(s, all_types)
        assert actual == expected

        s2 = str(actual)
        actual2 = Conjunction.from_string(s2, all_types)
        assert actual2 == actual
예제 #2
0
def _ask_conditions(conditions, all_columns, all_types):
    txt = prompt(
        message="Conditions: ",
        history=_history_conditions,
        default=str(conditions) if conditions is not None else "",
        completer=WordCompleter(sorted(all_columns)),
        validator=_ValidatorFromParse(
            partial(Conjunction.from_string, all_types=all_types)),
    )
    return Conjunction.from_string(txt, all_types)