How to use the retype.serialize_attribute function in retype

To help you get started, we’ve selected a few retype examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ambv / retype / tests / test_retype.py View on Github external
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)
github ambv / retype / tests / test_retype.py View on Github external
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)