def field_path(*field_names): """Create a **field path** from a list of nested field names. A **field path** is a ``.``-delimited concatenation of the field names. It is used to represent a nested field. For example, in the data .. code-block:: python data = { 'aa': { 'bb': { 'cc': 10, }, }, } the field path ``'aa.bb.cc'`` represents the data stored in ``data['aa']['bb']['cc']``. Args: field_names (Tuple[str, ...]): The list of field names. Returns: str: The ``.``-delimited field path. """ return render_field_path(field_names)
def field_path(*field_names: str) -> str: """Create a **field path** from a list of nested field names. A **field path** is a ``.``-delimited concatenation of the field names. It is used to represent a nested field. For example, in the data .. code-block:: python data = { 'aa': { 'bb': { 'cc': 10, }, }, } the field path ``'aa.bb.cc'`` represents the data stored in ``data['aa']['bb']['cc']``. Args: field_names: The list of field names. Returns: str: The ``.``-delimited field path. """ return render_field_path(field_names)
def test_render_field_path_multiple(): from google.cloud.firestore_v1 import field_path assert field_path.render_field_path(["a", "b", "c"]) == "a.b.c"
def test_render_field_path_w_one_w_backslash(): from google.cloud.firestore_v1 import field_path assert field_path.render_field_path(["a\\b"]) == "`a\\\\b`"
def test_render_field_path_w_one_w_backtick(): from google.cloud.firestore_v1 import field_path assert field_path.render_field_path(["a`b"]) == "`a\\`b`"
def test_render_field_path_w_one_w_non_alphanum(): from google.cloud.firestore_v1 import field_path assert field_path.render_field_path(["a b c"]) == "`a b c`"
def test_render_field_path_w_one_starts_w_digit(): from google.cloud.firestore_v1 import field_path assert field_path.render_field_path(["0abc"]) == "`0abc`"
def test_render_field_path_w_one_simple(): from google.cloud.firestore_v1 import field_path assert field_path.render_field_path(["a"]) == "a"
def test_render_field_path_w_empty(): from google.cloud.firestore_v1 import field_path assert field_path.render_field_path([]) == ""
def _call_fut(field_names): from google.cloud.firestore_v1 import field_path return field_path.render_field_path(field_names)
def _call_fut(field_names): from google.cloud.firestore_v1 import field_path return field_path.render_field_path(field_names)