(self)
| 853 | is_(set_0 != set_a, False) |
| 854 | |
| 855 | def test_set_mutation(self): |
| 856 | Parent = self.classes.Parent |
| 857 | |
| 858 | self.session = fixture_session() |
| 859 | |
| 860 | # mutations |
| 861 | for op in ( |
| 862 | "update", |
| 863 | "intersection_update", |
| 864 | "difference_update", |
| 865 | "symmetric_difference_update", |
| 866 | ): |
| 867 | for base in (["a", "b", "c"], []): |
| 868 | for other in ( |
| 869 | {"a", "b", "c"}, |
| 870 | {"a", "b", "c", "d"}, |
| 871 | {"a"}, |
| 872 | {"a", "b"}, |
| 873 | {"c", "d"}, |
| 874 | {"e", "f", "g"}, |
| 875 | set(), |
| 876 | ): |
| 877 | p = Parent("p") |
| 878 | p.children = base[:] |
| 879 | control = set(base[:]) |
| 880 | |
| 881 | getattr(p.children, op)(other) |
| 882 | getattr(control, op)(other) |
| 883 | try: |
| 884 | self.assert_(p.children == control) |
| 885 | except Exception: |
| 886 | print("Test %s.%s(%s):" % (set(base), op, other)) |
| 887 | print("want", repr(control)) |
| 888 | print("got", repr(p.children)) |
| 889 | raise |
| 890 | |
| 891 | p = self.roundtrip(p) |
| 892 | |
| 893 | try: |
| 894 | self.assert_(p.children == control) |
| 895 | except Exception: |
| 896 | print("Test %s.%s(%s):" % (base, op, other)) |
| 897 | print("want", repr(control)) |
| 898 | print("got", repr(p.children)) |
| 899 | raise |
| 900 | |
| 901 | # in-place mutations |
| 902 | for op in ("|=", "-=", "&=", "^="): |
| 903 | for base in (["a", "b", "c"], []): |
| 904 | for other in ( |
| 905 | {"a", "b", "c"}, |
| 906 | {"a", "b", "c", "d"}, |
| 907 | {"a"}, |
| 908 | {"a", "b"}, |
| 909 | {"c", "d"}, |
| 910 | {"e", "f", "g"}, |
| 911 | frozenset(["e", "f", "g"]), |
| 912 | set(), |
nothing calls this directly
no test coverage detected