code: def test_create_tag_from_filenames(mocker: MockerFixture) -> None:
      dataset_id = utils.generate_id()
      tags = _get_tags(dataset_id=dataset_id, tag_name="initial-tag")
      mocker.patch.object(
          ApiWorkflowClient, "__init__", return_value=None
      )
      mocker.patch.object(
          ApiWorkflowClient, "get_all_tags", return_value=tags
      )
      mocked_get_filenames = mocker.patch.object(
          ApiWorkflowClient,
          "get_filenames",
          return_value=[f"file{i}" for i in range(3)],
      )
      mocked_api = mocker.MagicMock()
  
      client = ApiWorkflowClient()
      client._tags_api = mocked_api
      client._dataset_id = dataset_id
      client._creator = TagCreator.UNKNOWN
      client.create_tag_from_filenames(
          fnames_new_tag=["file2"], new_tag_name="some-tag"
      )
      mocked_get_filenames.assert_called_once()
      mocked_api.create_tag_by_dataset_id.assert_called_once()
      kwargs = mocked_api.create_tag_by_dataset_id.call_args[1]
      # initial-tag is used as prev_tag_id when parent_tag_id is not given
      assert kwargs["tag_create_request"].prev_tag_id == tags[0].id
      assert kwargs["tag_create_request"].bit_mask_data == "0x4"
  
file_path: lightly/tests/api_workflow/test_api_workflow_tags.py
imports: from typing import List, Optional
  import pytest
  from pytest_mock import MockerFixture
  from lightly.api import ApiWorkflowClient
  from lightly.api.api_workflow_tags import TagDoesNotExistError
  from lightly.openapi_generated.swagger_client.models import TagCreator, TagData
  from tests.api_workflow import utils
label_desc: Use image node_id 2 for calling a global function with example usage: test_create_tag_from_filenames(mocker) without return types