Set intersection. Returns (new_variable, "Observation: ...").
(self, variable1: Variable, variable2: Variable)
| 112 | return new_variable, rtn_str |
| 113 | |
| 114 | def intersection(self, variable1: Variable, variable2: Variable): |
| 115 | """ |
| 116 | Set intersection. Returns (new_variable, "Observation: ..."). |
| 117 | """ |
| 118 | if variable1.type != variable2.type: |
| 119 | raise ValueError("intersection: two variables must have the same type") |
| 120 | if not isinstance(variable1, Variable) or not isinstance(variable2, Variable): |
| 121 | raise ValueError("intersection: variable must be a variable") |
| 122 | |
| 123 | rtn_str = f"Observation: variable ##, which are instances of {variable1.type}" |
| 124 | new_variable = Variable(variable1.type, f"(AND {variable1.program} {variable2.program})") |
| 125 | return new_variable, rtn_str |
| 126 | |
| 127 | def union(self, variable1: Variable, variable2: Variable): |
| 128 | """ |
no test coverage detected