mirror of
https://github.com/bugsink/bugsink.git
synced 2025-12-30 18:00:17 -06:00
@@ -152,7 +152,7 @@ def format_var(value):
|
||||
return get
|
||||
|
||||
def gen_base(obj):
|
||||
yield escape(repr(obj)), None
|
||||
yield escape(str(obj)), None
|
||||
|
||||
def bracket_wrap(gen, b_open, sep, b_close):
|
||||
yield b_open, None
|
||||
|
||||
@@ -80,6 +80,14 @@ class TestFormatVar(RegularTestCase):
|
||||
return format_var(var).replace("'", "'")
|
||||
|
||||
def test_format_var_none(self):
|
||||
# This is how we've actually observed None values in the SDKs, so we should also handle it
|
||||
self.assertEqual(
|
||||
"None",
|
||||
self._format_var("None"),
|
||||
)
|
||||
|
||||
# I _think_ SDKs generally don't send null (None) as a value, but if/when they do we should handle it
|
||||
# gracefully. See #119
|
||||
self.assertEqual(
|
||||
"None",
|
||||
self._format_var(None),
|
||||
@@ -92,11 +100,12 @@ class TestFormatVar(RegularTestCase):
|
||||
"c": {"d": 4},
|
||||
"d": [],
|
||||
"e": {},
|
||||
"f": None,
|
||||
"f": "None",
|
||||
"g": "<python obj>",
|
||||
}
|
||||
|
||||
self.assertEqual(
|
||||
"{'a': 1, 'b': [2, 3], 'c': {'d': 4}, 'd': [], 'e': {}, 'f': None}",
|
||||
"{'a': 1, 'b': [2, 3], 'c': {'d': 4}, 'd': [], 'e': {}, 'f': None, 'g': <python obj>}",
|
||||
self._format_var(var),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user