masaori335 commented on code in PR #13665:
URL: https://github.com/apache/trafficserver/pull/13665#discussion_r3976845372
##########
tools/hrw4u/tests/test_ast_nodes.py:
##########
@@ -15,27 +15,31 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from hrw4u.ast_nodes import Target
+import pytest
+from hrw4u.ast_nodes import Span
-class TestTarget:
- def test_dotted_path(self):
- t = Target.from_dotted("inbound.req.X-Foo")
- assert t.namespace == "inbound.req"
- assert t.field == "X-Foo"
+class TestSpan:
- def test_two_segments(self):
- t = Target.from_dotted("inbound.ip")
- assert t.namespace == "inbound"
- assert t.field == "ip"
+ def test_equality_is_by_value(self):
+ assert Span(file="a", line=1, column=0) == Span(file="a", line=1,
column=0)
+ assert Span(file="a", line=1, column=0) != Span(file="b", line=1,
column=0)
- def test_no_dots(self):
- t = Target.from_dotted("bool_0")
- assert t.namespace is None
- assert t.field == "bool_0"
+ def test_is_hashable_so_it_can_key_a_span_index(self):
+ first = Span(file="a", line=1, column=0)
+ assert {first: "node"}[Span(file="a", line=1, column=0)] == "node"
- def test_deep_namespace(self):
- t = Target.from_dotted("http.cntl.TXN_DEBUG")
- assert t.namespace == "http.cntl"
- assert t.field == "TXN_DEBUG"
+ def test_is_immutable(self):
+ span = Span(file="a", line=1, column=0)
+ with pytest.raises(Exception):
+ span.line = 2
Review Comment:
Fixed by 04133e312884032376e56d402ca602ebb784fe9e
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]