|
30 | 30 | _get_installed_modules, |
31 | 31 | _generate_installed_modules, |
32 | 32 | ensure_integration_enabled, |
| 33 | + _serialize_span_attribute, |
33 | 34 | ) |
34 | 35 |
|
35 | 36 |
|
@@ -901,3 +902,28 @@ def test_format_timestamp_naive(): |
901 | 902 | # Ensure that some timestamp is returned, without error. We currently treat these as local time, but this is an |
902 | 903 | # implementation detail which we should not assert here. |
903 | 904 | assert re.fullmatch(timestamp_regex, format_timestamp(datetime_object)) |
| 905 | + |
| 906 | + |
| 907 | +@pytest.mark.parametrize( |
| 908 | + ("value", "result"), |
| 909 | + ( |
| 910 | + ("meow", "meow"), |
| 911 | + (1, 1), |
| 912 | + (47.0, 47.0), |
| 913 | + (True, True), |
| 914 | + (["meow", "bark"], ["meow", "bark"]), |
| 915 | + ([True, False], [True, False]), |
| 916 | + ([1, 2, 3], [1, 2, 3]), |
| 917 | + ([46.5, 47.0, 47.5], [46.5, 47.0, 47.5]), |
| 918 | + (["meow", 47], '["meow", 47]'), # mixed types not allowed in a list |
| 919 | + (None, "null"), |
| 920 | + ( |
| 921 | + {"cat": "meow", "dog": ["bark", "woof"]}, |
| 922 | + '{"cat": "meow", "dog": ["bark", "woof"]}', |
| 923 | + ), |
| 924 | + (datetime(2024, 1, 1), "2024-01-01 00:00:00"), |
| 925 | + (("meow", "purr"), ["meow", "purr"]), |
| 926 | + ), |
| 927 | +) |
| 928 | +def test_serialize_span_attribute(value, result): |
| 929 | + assert _serialize_span_attribute(value) == result |
0 commit comments