Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_serialize_attribute(self) -> None:
src_txt = "a.b.c"
expected = "a.b.c"
src = ast3.parse(dedent(src_txt))
assert isinstance(src, ast3.Module)
attr_expr = src.body[0]
self.assertEqual(serialize_attribute(attr_expr), expected)
def test_serialize_name(self) -> None:
src_txt = "just_a_flat_name"
expected = "just_a_flat_name"
src = ast3.parse(dedent(src_txt))
assert isinstance(src, ast3.Module)
attr_expr = src.body[0]
self.assertEqual(serialize_attribute(attr_expr), expected)