)]}'
{"neutron/tests/unit/common/test_utils.py":[{"author":{"_account_id":5756,"name":"Terry Wilson","email":"twilson@redhat.com","username":"otherwiseguy"},"change_message_id":"30458b08fa5d1c16906e66a301bbc5f690957514","unresolved":false,"context_lines":[{"line_number":751,"context_line":"        with testtools.ExpectedException(ValueError):"},{"line_number":752,"context_line":"            utils.port_rule_masking(12, 5)"},{"line_number":753,"context_line":""},{"line_number":754,"context_line":"    def test_port_rule_masking(self):"},{"line_number":755,"context_line":"        # (port_min, port_max) tuples"},{"line_number":756,"context_line":"        TESTING_DATA \u003d ["},{"line_number":757,"context_line":"            (5, 12),"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa6399be_c97acf23","line":754,"updated":"2016-10-14 20:58:37.000000000","message":"It feels like this test needs a set of tests written for it. :) I get testing two independent solutions against each other, for some reason it just seems safer to test against known right answers.\n\nIf we do go this route, though, since the only thing that we are testing is equivalent answers, we could generate a lot of calls without having to specify them exactly. Given that there are *lots* of combinations of two valid port numbers, testing them all isn\u0027t wise but we could generate some random ones with something like:\n\n    # calling randint a bunch of times is really slow\n    randports \u003d sorted(random.sample(xrange(1, 65536), 10000))\n    last \u003d 0\n    for i in randports:\n        port_min \u003d last\n        last \u003d port_max \u003d i\n        observed \u003d utils.port_rule_masking(port_min, port_max)\n        expected \u003d _port_rule_masking(port_min, port_max)\n        self.assertItemsEqual(expected, observed)\n\nOnly takes about 0.5 seconds on my small dev vm. Yes, nondeterminism can be bad. But it seems like it would be ok when comparing output between two different implementations.","commit_id":"5e62bbeef4bf681b3e23f485647e4caa0579103e"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"201af4e3a54d73e287c19c65bb363d2eab3393d9","unresolved":false,"context_lines":[{"line_number":751,"context_line":"        with testtools.ExpectedException(ValueError):"},{"line_number":752,"context_line":"            utils.port_rule_masking(12, 5)"},{"line_number":753,"context_line":""},{"line_number":754,"context_line":"    def test_port_rule_masking(self):"},{"line_number":755,"context_line":"        # (port_min, port_max) tuples"},{"line_number":756,"context_line":"        TESTING_DATA \u003d ["},{"line_number":757,"context_line":"            (5, 12),"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa6399be_dfbb45c2","line":754,"in_reply_to":"fa6399be_c97acf23","updated":"2016-10-17 08:30:43.000000000","message":"Good suggestion. I\u0027m just thinking whether we should rather test more pairs (like 10000) that generate very small ranges or decrease number of pairs and get bigger ranges.","commit_id":"5e62bbeef4bf681b3e23f485647e4caa0579103e"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"4680889a6a92a769a87b396a86458ed2e6e53b59","unresolved":false,"context_lines":[{"line_number":62,"context_line":"        common mask, it\u0027s merged. Then it continues to do the same with the"},{"line_number":63,"context_line":"        rest of the list."},{"line_number":64,"context_line":"        \"\"\""},{"line_number":65,"context_line":"        if self.can_merge:"},{"line_number":66,"context_line":"            self.mask \u003c\u003c\u003d 1"},{"line_number":67,"context_line":"            self.base \u003d self.prev_ref.base"},{"line_number":68,"context_line":"            if self.prev_ref:"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a74a57a_4d94bde7","line":65,"updated":"2016-11-30 09:09:24.000000000","message":"What happens if we want to shake 1001 times? :)\n\nIf I understand the logic correctly, you can just change L65 to \u0027while self.can_merge\u0027 and get rid of L70-71","commit_id":"c5865ee174891a156ede5b59c408ab62af031cca"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"dc4cc6b74686a784115a5628aa5365ea67b4aca7","unresolved":false,"context_lines":[{"line_number":62,"context_line":"        common mask, it\u0027s merged. Then it continues to do the same with the"},{"line_number":63,"context_line":"        rest of the list."},{"line_number":64,"context_line":"        \"\"\""},{"line_number":65,"context_line":"        if self.can_merge:"},{"line_number":66,"context_line":"            self.mask \u003c\u003c\u003d 1"},{"line_number":67,"context_line":"            self.base \u003d self.prev_ref.base"},{"line_number":68,"context_line":"            if self.prev_ref:"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a74a57a_132028f7","line":65,"in_reply_to":"5a74a57a_4d94bde7","updated":"2016-11-30 09:47:16.000000000","message":"Done","commit_id":"c5865ee174891a156ede5b59c408ab62af031cca"}]}
