old_contents: import pytest
  
  from micromanager.resources import Resource
  from micromanager.resources import BQDataset
  from micromanager.resources import Bucket
  from micromanager.resources import SQLInstance
  
  test_cases = [
      (
          {'resource_kind': 'storage#bucket'},
          Bucket
      ),
      (
          {'resource_kind': 'sql#instance'},
          SQLInstance
      ),
      (
          {'resource_kind': 'bigquery#dataset'},
          BQDataset
      )
  ]
  
  
  @pytest.mark.parametrize(
      "input,expected",
      test_cases,
      ids=[cls.__name__ for (_, cls) in test_cases])
  def test_resource_factory(input, expected):
          r = Resource.factory(input)
          assert r.__class__ == expected
  
  def test_resource_factory_invalid():
          with pytest.raises(AssertionError):
              r = Resource.factory({})
  
new_contents: import pytest
  
  from .util import load_test_data
  from .util import discovery_cache
  
  from .mock import HttpMockSequenceEx
  
  from googleapiclient.http import HttpMockSequence
  
  from micromanager.resources import Resource
  from micromanager.resources.gcp import GcpBigqueryDataset
  from micromanager.resources.gcp import GcpComputeInstance
  from micromanager.resources.gcp import GcpSqlInstance
  from micromanager.resources.gcp import GcpStorageBucket
  from micromanager.resources.gcp import GcpStorageBucketIamPolicy
  
  test_cases = [
      (
          {'resource_type': 'bigquery.datasets', 'resource_name': '', 'project_id': ''},
          GcpBigqueryDataset,
          'gcp.bigquery.datasets'
      ),
      (
          {'resource_type': 'compute.instances', 'resource_name': '', 'project_id': ''},
          GcpComputeInstance,
          'gcp.compute.instances'
      ),
      (
          {'resource_type': 'sqladmin.instances', 'resource_name': '', 'project_id': ''},
          GcpSqlInstance,
          'gcp.sqladmin.instances'
      ),
      (
          {'resource_type': 'storage.buckets', 'resource_name': '', 'project_id': ''},
          GcpStorageBucket,
          'gcp.storage.buckets'
      ),
      (
          {'resource_type': 'storage.buckets.iam', 'resource_name': '', 'project_id': ''},
          GcpStorageBucketIamPolicy,
          'gcp.storage.buckets.iam'
      )
  ]
  
  
  @pytest.mark.parametrize(
      "input,cls,rtype",
      test_cases,
      ids=[cls.__name__ for (_, cls, _) in test_cases])
  def test_gcp_resource_factory(input, cls, rtype):
      r = Resource.factory("gcp", input)
      assert r.__class__ == cls
      assert r.type() == rtype
  
  def test_gcp_resource_factory_invalid():
      with pytest.raises(AssertionError):
          r = Resource.factory('gcp', {})
  
subject: Update tests after lots of work on Resources