1import pytest
2
3from ddtrace.context import Context
4from ddtrace.span import Span
5
6
7@pytest.mark.parametrize(
8    "ctx1,ctx2",
9    [
10        (Context(), Context()),
11        (Context(trace_id=123), Context(trace_id=123)),
12        (
13            Context(trace_id=123, span_id=321, dd_origin="synthetics", sampling_priority=2),
14            Context(trace_id=123, span_id=321, dd_origin="synthetics", sampling_priority=2),
15        ),
16    ],
17)
18def test_eq(ctx1, ctx2):
19    assert ctx1 == ctx2
20
21
22@pytest.mark.parametrize(
23    "ctx1,ctx2",
24    [
25        (Context(), Span(None, "")),
26        (Context(), None),
27        (Context(), object()),
28        (None, Context()),
29        (Context(), 5),
30        (5, Context()),
31        (
32            Context(trace_id=123, span_id=321, dd_origin="synthetics", sampling_priority=2),
33            Context(trace_id=1234, span_id=321, dd_origin="synthetics", sampling_priority=2),
34        ),
35        (
36            Context(trace_id=123, span_id=321, dd_origin="synthetics", sampling_priority=2),
37            Context(trace_id=123, span_id=3210, dd_origin="synthetics", sampling_priority=2),
38        ),
39        (
40            Context(trace_id=123, span_id=321, dd_origin="synthetics", sampling_priority=2),
41            Context(trace_id=123, span_id=321, dd_origin="synthetics1", sampling_priority=2),
42        ),
43        (
44            Context(trace_id=123, span_id=321, dd_origin="synthetics", sampling_priority=2),
45            Context(trace_id=123, span_id=321, dd_origin="synthetics", sampling_priority=0),
46        ),
47    ],
48)
49def test_not_eq(ctx1, ctx2):
50    assert ctx1 != ctx2
51