def test_relation(self): self.assertEqual( read_sample(example), [ frozendict({"y": "c", "x": frozenset(["a", "b"])}), frozendict({"y": "c"}), frozendict({"y": "c", "x": ("a", "d")}), ], )
def build_tuple(s, sort): p = map(parse_value, s.split(',')) t = {} # tuple for x in zip(sort, p): if x[1] is not None: t[x[0]] = x[1] return frozendict(t)
def test_all_formulas(self): self.assertEqual( get_all_formulas(read_sample("x,y\n1,2\n3,4")), set( [ frozendict({}), frozendict({"x": "1"}), frozendict({"y": "2"}), frozendict({"x": "3"}), frozendict({"y": "4"}), frozendict({"y": "2", "x": "1"}), frozendict({"y": "4", "x": "3"}), ] ), ) self.assertEqual( get_all_formulas(read_sample("x\n{1 2}\n{3 4}")), set( [ frozendict({}), frozendict({"x": frozenset(["1"])}), frozendict({"x": frozenset(["4"])}), frozendict({"x": frozenset(["3"])}), frozendict({"x": frozenset(["2"])}), frozendict({"x": frozenset(["1", "2"])}), frozendict({"x": frozenset(["3", "4"])}), ] ), )