-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PCVL 843 Input ports should be kept when composing a processor to an empty processor #516
Conversation
tests/test_processor_composition.py
Outdated
@@ -115,6 +115,27 @@ def test_remote_processor_creation(requests_mock): | |||
rp.add(0, BS()) | |||
|
|||
|
|||
def test_remote_processor_composition_input_ports(requests_mock): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, the bug was with any empty processor (so an empty remote processor or a local empty processor Processor("SLOS", 4)
), you don't really need the requests_mock here. However, it can still be useful to test it like this since it is the principal use case
tests/test_processor_composition.py
Outdated
def test_remote_processor_composition_input_ports(requests_mock): | ||
ls = LogicalState([0, 0]) | ||
cnot = catalog['postprocessed cnot'].build_processor() | ||
cnot.min_detected_photons_filter(2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this line (you don't need it since you don't use cnot.with_input(ls)
)
rp_input_port = rp.get_input_port(mode) | ||
assert cnot_input_port == rp_input_port | ||
|
||
cnot_output_port = cnot.get_output_port(mode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ticket only asks for the input ports, so here you are testing something that you didn't change (my bad).
Since there were no tests for the output ports, you can keep it though.
@@ -397,6 +397,12 @@ def _compose_processor(self, connector: ModeConnector, processor, keep_port: boo | |||
self._postselect = self._postselect or PostSelect() | |||
self._postselect.merge(other_postselect) | |||
|
|||
# Adding input ports from component processor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add this piece of code before or after the _out_ports piece of code.
Also, consider breaking this method in sub methods (one for ports & post selection and one for permutation at least ?)
…ieving output ports
…cessor