From fe67d45fecf8bfee0e0f0e9eb1fe9cecd6214645 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Thu, 22 Aug 2024 17:45:20 +0200 Subject: [PATCH] events: test Event name precedence in attributes (#4142) --- opentelemetry-api/tests/events/test_event.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/opentelemetry-api/tests/events/test_event.py b/opentelemetry-api/tests/events/test_event.py index b741cc65e23..227dcf5b1ff 100644 --- a/opentelemetry-api/tests/events/test_event.py +++ b/opentelemetry-api/tests/events/test_event.py @@ -11,3 +11,11 @@ def test_event(self): self.assertEqual( event.attributes, {"key": "value", "event.name": "example"} ) + + def test_event_name_copied_in_attributes(self): + event = Event("name", 123) + self.assertEqual(event.attributes, {"event.name": "name"}) + + def test_event_name_has_precedence_over_attributes(self): + event = Event("name", 123, attributes={"event.name": "attr value"}) + self.assertEqual(event.attributes, {"event.name": "name"})