async def test_get_subscription_seats_exceeded_invalid_kind( api_client: Client, mocker: MockFixture, mock_get_token_for_install: None ) -> None: """ Handle mismatch in subscription_blocker types between data parameter and subscription_blocker. """ fake_redis = create_fake_redis_reply( { b"account_id": b"DF5C23EB-585B-4031-B082-7FF951B4DE15", b"subscription_blocker": b"seats_exceeded", b"data": b'{"kind":"trial_expired", "allowed_user_ids": [5234234]}', } ) mocker.patch( "kodiak.event_handlers.get_redis", return_value=wrap_future(fake_redis) ) async with api_client as api_client: res = await api_client.get_subscription() assert res == Subscription( account_id="DF5C23EB-585B-4031-B082-7FF951B4DE15", subscription_blocker=SeatsExceeded(allowed_user_ids=[]), )
def test_evaluate_on_string_default_args(mocker: MockFixture): text = 'MyClass' prep_line = ['My', 'Class</t>'] types = [SplitContainer, SplitContainer] result = EvaluationResult(prep_line, list(map(lambda t: t.__name__, types)), [1.0, 2.0], 3.0) scenarios = {EvaluationScenario('full_token_entropy'): result} trained_model_mock = Mock(spec=TrainedModel) trained_model_mock.get_entropies_for_text.return_value = ([1.0, 2.0], prep_line, types) mocked_metric = Mock(spec=callable, return_value={TokenTypeSubset.full_set(): result}) mocker.patch('langmodels.evaluation.evaluation._get_metric_by_name', new=lambda x: mocked_metric) mocker.patch('langmodels.evaluation.evaluation.get_metrics_name', new=lambda x: 'full_token_entropy') actual = evaluate_model_on_string(trained_model_mock, text) mocked_metric.assert_called_with(trained_model_mock, text, 'java', False, None, sys.maxsize) assert actual == [Evaluation(text, scenarios)]
def test_secrets(mocker: ptm.MockFixture) -> None: get_encryption_key, encrypt_using_key, upload_secret, sys_exit = ( mocker.patch('ghsa.__main__.get_encryption_key'), mocker.patch('ghsa.__main__.encrypt_using_key'), mocker.patch('ghsa.__main__.upload_secret'), mocker.patch('sys.exit'), ) encryption_key = mocker.Mock(spec=str) encryption_key_id = mocker.Mock(spec=str) get_encryption_key.return_value = encryption_key, encryption_key_id encrypt_using_key.return_value = mocker.ANY main( { 'a': '1', 'b': '2', }, gh_token='token', gh_repository='repo', ) get_encryption_key.assert_called_once_with('repo', 'token') assert encrypt_using_key.call_count == 2 encrypt_using_key.assert_any_call('1', key=encryption_key) encrypt_using_key.assert_any_call('2', key=encryption_key) assert upload_secret.call_count == 2 upload_secret.assert_any_call('repo', 'token', encryption_key_id, 'a', mocker.ANY) upload_secret.assert_any_call('repo', 'token', encryption_key_id, 'b', mocker.ANY) assert not sys_exit.called
def test_to_graph_should_return_distribution_skolemized( mocker: MockFixture) -> None: """It returns a distribution graph isomorphic to spec.""" dataset = Dataset() dataset.identifier = "http://example.com/datasets/1" distribution1 = Distribution() dataset.distributions.append(distribution1) src = """ @prefix dct: <http://purl.org/dc/terms/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix dcat: <http://www.w3.org/ns/dcat#> . @prefix prov: <http://www.w3.org/ns/prov#> . <http://example.com/datasets/1> a dcat:Dataset ; dcat:distribution <http://wwww.digdir.no/.well-known/skolem/284db4d2-80c2-11eb-82c3-83e80baa2f94> . """ mocker.patch( "skolemizer.Skolemizer.add_skolemization", return_value=skolemization, ) g1 = Graph().parse(data=dataset.to_rdf(include_distributions=False), format="turtle") g2 = Graph().parse(data=src, format="turtle") _isomorphic = isomorphic(g1, g2) if not _isomorphic: _dump_diff(g1, g2) pass assert _isomorphic
def test_noexc_smtpd_missing(self, mocker: MockFixture, silence_event_loop_closed: bool): # Hypothetical situation where factory() failed but no # Exception was generated. cont = Controller(Sink()) def hijacker(*args, **kwargs): cont._thread_exception = None # Must still return an (unmocked) _FakeServer to prevent a whole bunch # of messy exceptions, although they doesn't affect the test at all. return _FakeServer(cont.loop) mocker.patch("aiosmtpd.controller._FakeServer", side_effect=hijacker) mocker.patch("aiosmtpd.controller.SMTP", side_effect=RuntimeError("Simulated Failure")) expectedre = r"Unknown Error, failed to init SMTP server" try: with pytest.raises(RuntimeError, match=expectedre): cont.start() assert cont.smtpd is None assert cont._thread_exception is None finally: cont.stop()
def test_app_add_with_custom_base_path(mocker: ptm.MockFixture) -> None: server_url = '/api/v1/' arg_base_path = '/' spec_one = mocker.stub() spec_one.servers = [ model.OASServer(url=server_url, variables={}), ] apply_spec = mocker.patch('axion.plugins._aiohttp._apply_specification') get_base_path = mocker.patch('axion.plugins._aiohttp._get_base_path') the_app = app.AioHttpPlugin(configuration=mocker.ANY) the_app.add_api(spec_one, base_path=arg_base_path) assert 1 == len(the_app.api_base_paths) assert arg_base_path in the_app.api_base_paths assert server_url not in the_app.api_base_paths apply_spec.assert_any_call( for_app=the_app.root_app, spec=spec_one, ) get_base_path.assert_not_called()
async def test_est_workflow(async_client: AsyncClientFixture, mocker: MockFixture, reg, host, port, pub_port, timeout, expected_host): mocked_is_remote_host = mocker.patch( 'cylc.uiserver.workflows_mgr.is_remote_host') mocked_is_remote_host.side_effect = lambda x: True \ if x == 'remote' else False mocked_client = mocker.patch( 'cylc.uiserver.workflows_mgr.WorkflowRuntimeClient') mocked_client.return_value = async_client mocked_get_host_ip_by_name = mocker.patch( 'cylc.uiserver.workflows_mgr.get_host_ip_by_name') mocked_get_host_ip_by_name.side_effect = lambda x: 'remote_host' \ if x == 'remote' else x r_reg, r_host, r_port, r_pub_port, r_client, r_result = await est_workflow( reg, host, port, pub_port, timeout) assert reg == r_reg assert expected_host == r_host assert port == r_port assert pub_port == r_pub_port assert r_client.__class__ == AsyncClientFixture
def test_user_professionals_generate_calendar( user: User, client_with_token: Client, professionals: QuerySet, mocker: MockFixture, ): """Should return a user professional.""" mock = mocker.patch("professionals.views.generate_for_professional") obj = professionals.filter(user=user).first() response = client_with_token.post( reverse("user-professionals-generate-calendar", args=[obj.pk])) data = response.json() assert response.status_code == 200 assert data["status"] == "ok" mock.assert_called_once_with(obj)
def test_all_companies_with_birthday( company_factory, client_factory, manager_factory, mocker: MockFixture ): companies = company_factory.create_batch(3) # Reset current tenant, as factories set in internally set_current_tenant(None) for company in companies: client_factory.create_batch( 3, birthday=date(2019, 1, 1), company=company) manager_factory.create_batch(3, user__company=company) mock_user_to_user = mocker.patch( 'bot.api.cron.cron_client_events.UserToUserBirthday', autospec=True) mock_users_to_manager = mocker.patch( 'bot.api.cron.cron_client_events.UsersToManagerBirthday', autospec=True) with freeze_time(date(2019, 1, 1)): birthday() assert_that(mock_user_to_user.call_count, is_(3)) assert_that(mock_users_to_manager.call_count, is_(3))
def client(mocker: MockFixture) -> Generator[TestClient, None, None]: # fix staelette.testclient get_event_loop status is close def get_event_loop() -> asyncio.AbstractEventLoop: try: loop: asyncio.AbstractEventLoop = asyncio.get_event_loop() if loop.is_closed(): loop = asyncio.new_event_loop() except RuntimeError as e: loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) return loop mocker.patch("asyncio.get_event_loop").return_value = get_event_loop() client: TestClient = TestClient(create_app()) yield client
def test_pipeline_run_monitor_success(monkeypatch, mocker: MockFixture): """ Test main function for expected success """ # arrange monkeypatch.setenv("WORKSPACE_NAME", "mock_workspace_name") monkeypatch.setenv("SUBSCRIPTION_ID", "mock_subscription_id") monkeypatch.setenv("RESOURCE_GROUP", "mock_resource_group") monkeypatch.setenv( "APP_INSIGHTS_CONNECTION_STRING", "InstrumentationKey=00000000-0000-0000-0000-000000000001") # create mock logger by assign name and info function mock_logger = logging.getLogger( 'src.PipelineRunMonitor.pipeline_run_monitor') mock_logger_info = mocker.patch.object(mock_logger, 'info') mock_workspace = mocker.patch( "src.PipelineRunMonitor.pipeline_run_monitor.Workspace") mock_run = mocker.patch("src.PipelineRunMonitor.pipeline_run_monitor.Run") mock_run.return_value.get.return_value = mock_run event = func.EventGridEvent( id="xxx", data={"runId": "xxx"}, topic="httpxxx", subject="xxx", event_type="Microsoft.MachineLearningServices.RunCompleted", event_time=0, data_version="xxx") # act main(event) # assert mock_logger_info.assert_called_once() mock_workspace.assert_called_once()
def test_show_config(mocker: MockFixture) -> None: mock_bucket = "test-bucket" mock_config = "test-config" mock_yaml_config = "test-yaml-config" structured_config: StructuredConfig = { "opta_version": "dev", "date": datetime.utcnow().isoformat(), "original_spec": mock_yaml_config, "defaults": {}, } mock_logger = mocker.patch("opta.commands.show.logger") mocker.patch( "opta.commands.show.AWS.get_all_remote_configs", return_value={mock_bucket: { mock_config: structured_config }}, ) runner = CliRunner() result = runner.invoke(config, ["--cloud", "aws"]) assert result.exit_code == 0 mock_logger.info.assert_called_once_with( f"# Bucket Name: {mock_bucket}\n# Config Name: {mock_config}\n{mock_yaml_config}\n" )
def test_check_opta_file_exists_file_does_not_exists_no_user_input( mocker: MockFixture, ) -> None: mock_config_path = "mock_config_path" mock_no_user_config_path = "" mock_os_path_exists = mocker.patch( "opta.utils.os.path.exists", side_effect=[False, False] ) mock_click_prompt = mocker.patch( "opta.utils.click.prompt", return_value=mock_no_user_config_path ) mock_system_exit = mocker.patch("opta.utils.sys.exit") config_path = check_opta_file_exists(mock_config_path) assert config_path == mock_no_user_config_path mock_os_path_exists.assert_called_once_with(mock_config_path) mock_click_prompt.assert_called_once_with( "Enter a Configuration Path (Empty String will exit)", default="", type=click.STRING, show_default=False, ) mock_system_exit.assert_called_once_with(0)
def test_send_go_live_request(notify_api: Flask, sample_service: Service, mocker: MockFixture): deal_id = "1" search_deal_id_mock = mocker.patch("app.user.rest.ZenDeskSell.search_deal_id", return_value=deal_id) send_create_service_mock = mocker.patch("app.user.rest.ZenDeskSell.send_create_service", return_value="1") create_note_mock = mocker.patch("app.user.rest.ZenDeskSell.create_note", return_value="2") data: Dict[str, Any] = { "email_address": "*****@*****.**", "service_name": "service_name", "department_org_name": "department_org_name", "intended_recipients": "intended_recipients", "main_use_case": "main_use_case", "notification_types": "notification_types", "expected_volume": "expected_volume", "service_url": "service_url", "support_type": "go_live_request", } contact = ContactRequest(**data) with notify_api.app_context(): assert ZenDeskSell().send_go_live_request(sample_service, sample_service.users[0], contact) search_deal_id_mock.assert_called_once_with(sample_service) send_create_service_mock.assert_not_called() create_note_mock.assert_called_once_with(ZenDeskSell.NoteResourceType.DEAL, deal_id, contact)
def test_generate_future_availability_slots_task( professionals: QuerySet, services: QuerySet, mocker: MockFixture, ): """Should generate future availability slots.""" professionals_generator = mocker.patch( "schedule.availability.tasks.generate_for_professional") services_generator = mocker.patch( "schedule.availability.tasks.generate_for_service") generate_future_availability_slots_task.apply_async() assert professionals_generator.call_count == professionals.count() assert services_generator.call_count == services.filter( is_base_schedule=False).count() professionals_generator.assert_called_with( professionals.last(), append_days=True, ) services_generator.assert_called_with( services.filter(is_base_schedule=False).last(), append_days=True, )
def test_force_unlock_gcp(self, mocker: MockFixture) -> None: mock_layer = mocker.Mock(spec=Layer) mock_layer.gen_providers.return_value = { "terraform": { "backend": { "gcs": { "bucket": "opta-tf-state-test-dev1", "prefix": "dev1" } } }, "provider": { "google": { "region": "us-central1", "project": "dummy-project" } }, } mocker.patch("opta.core.terraform.GCP") mock_get_gcp_lock_id = mocker.patch( "opta.core.terraform.Terraform._get_gcp_lock_id", return_value="mock_gcp_lock_id", ) mock_force_unlock_nice_run = mocker.patch( "opta.core.terraform.nice_run") Terraform.force_unlock(mock_layer) mock_layer.gen_providers.assert_called_once_with(0, clean=False) mock_get_gcp_lock_id.assert_called_once_with(mock_layer) mock_force_unlock_nice_run.assert_called_once_with( ["terraform", "force-unlock", mock_get_gcp_lock_id.return_value], check=True, use_asyncio_nice_run=True, )
async def test_handle(self, command_processor: CommandProcessor, boolean2: Tuple[bool, bool], mocker: MockFixture) -> None: mocker.patch('mautrix_telegram.user.config', self.config) mocker.patch('mautrix.bridge.commands.handler.command_handlers', { "help": AsyncMock(), "unknown-command": AsyncMock() }) sender = u.User(UserID("@sender:example.org")) result = await command_processor.handle( room_id=RoomID("#mock_room:example.org"), event_id=EventID("$H45H:example.org"), sender=sender, command="hElp", args=[], content=Mock(), is_management=boolean2[0], is_portal=boolean2[1]) assert result is None command_handlers = mautrix.bridge.commands.handler.command_handlers command_handlers["help"].mock.assert_called_once() # type: ignore
def test_db_verbosity( cli_runner: testing.CliRunner, mocker: ptm.MockFixture, invoke_arg: t.List[str], ) -> None: from loguru import logger enable_spy = mocker.spy(logger, name='enable') disable_spy = mocker.spy(logger, name='disable') add_spy = mocker.spy(logger, name='add') _ = mocker.patch('asyncpg_migrate.loader.load_configuration') from asyncpg_migrate import main @main.db.command(name='test', short_help='test command') def test() -> None: click.echo(1) result = cli_runner.invoke(main.db, invoke_arg) assert result.exit_code == 0 if invoke_arg[0] == '-v' or invoke_arg[0] == '--verbose': assert enable_spy.called assert not disable_spy.called assert add_spy.mock_calls[0].kwargs == { 'format': '{time} {message}', 'filter': 'asyncpg-migrate', 'level': 'INFO', } elif invoke_arg[0] == '-vv': assert enable_spy.called assert not disable_spy.called assert add_spy.mock_calls[0].kwargs == { 'format': '{time} {message}', 'filter': 'asyncpg-migrate', 'level': 'DEBUG', } elif invoke_arg[0] == '-vvv': assert enable_spy.called assert not disable_spy.called assert add_spy.mock_calls[0].kwargs == { 'format': '{time} {message}', 'filter': 'asyncpg-migrate', 'level': 'TRACE', } else: assert not enable_spy.called assert disable_spy.called assert not add_spy.called
def test_saved_chart_unknown_chart_id(mocker: MockFixture, app_context: AppContext) -> None: from superset.connectors.sqla.models import SqlaTable from superset.explore.form_data.utils import check_access with raises(ChartNotFoundError): mocker.patch(dataset_find_by_id, return_value=SqlaTable()) mocker.patch(can_access_datasource, return_value=True) mocker.patch(chart_find_by_id, return_value=None) check_access(dataset_id=1, chart_id=1, actor=User())
def test_pait(self, mocker: MockFixture) -> None: for i in app.auto_load_app.app_list: self._clean_app_from_sys_module() importlib.import_module(i) patch = mocker.patch(f"pait.app.{i}.pait") app.pait() patch.assert_called_once() class Demo: pass with pytest.raises(NotImplementedError) as e: app.load_app(Demo) exec_msg: str = e.value.args[0] assert exec_msg.startswith("Pait not support")
def test_upload_secret(mocker: ptm.MockFixture) -> None: put = mocker.patch('requests.put') upload_secret( mocker.ANY, mocker.ANY, mocker.ANY, mocker.ANY, mocker.ANY, ) put.assert_called_once_with( mocker.ANY, headers=mocker.ANY, json=mocker.ANY, )
def test_review_notifier( user: User, professionals: QuerySet, mocker: MockFixture, ): """Should run a notifier on save.""" mock = mocker.patch("communication.models.Review.notifier") professional = professionals.exclude(user=user).first() review = Review() review.user = user review.professional = professional review.title = "title" review.description = "description" review.rating = RatingField.GOOD review.save() assert mock.call_count == 1
def test_load_app(self, mocker: MockFixture) -> None: for i in app.auto_load_app.app_list: patch = mocker.patch(f"pait.app.{i}.load_app") app.load_app( importlib.import_module(f"example.param_verify.{i}_example"). create_app()) # type: ignore patch.assert_called_once() class Demo: pass with pytest.raises(NotImplementedError) as e: app.load_app(Demo) exec_msg: str = e.value.args[0] assert exec_msg.startswith("Pait not support")
def test_verify_parent_layer_client_error(mocker: MockFixture, mocked_layer: Any) -> None: mocked_get_terraform_outputs = mocker.patch( "opta.commands.apply.get_terraform_outputs") mocked_get_terraform_outputs.side_effect = ClientError( error_response={"Error": { "Code": "AccessDenied", "Message": "Blah" }}, operation_name="Blah", ) mocked_layer.parent = mocker.Mock(spec=Layer) mocked_layer.parent.name = "Parent Name" with pytest.raises(UserErrors): _verify_parent_layer(mocked_layer) mocked_get_terraform_outputs.assert_called_once_with(mocked_layer.parent)
def test_view(self, mocker: MockFixture, mocked_layer: Any) -> None: # noqa # Opta file check mocked_os_path_exists = mocker.patch("opta.utils.os.path.exists") mocked_os_path_exists.return_value = os.path.join( os.getcwd(), "tests", "fixtures", "dummy_data", "dummy_config1.yaml") mocker.patch("opta.commands.secret.set_kube_config") mocked_create_namespace_if_not_exists = mocker.patch( "opta.commands.secret.create_namespace_if_not_exists") mocked_get_secret_name_and_namespace = mocker.patch( "opta.commands.secret.get_secret_name_and_namespace") mocked_get_secret_name_and_namespace.return_value = [ "manual-secrets", "dummy_layer", ] mocked_get_secrets = mocker.patch("opta.commands.secret.get_secrets") mocked_get_secrets.return_value = { "dummysecret": "1", "b": "2", "c": "3" } mocked_amplitude_client = mocker.patch( "opta.commands.secret.amplitude_client", spec=AmplitudeClient) mocked_amplitude_client.VIEW_SECRET_EVENT = amplitude_client.VIEW_SECRET_EVENT runner = CliRunner() result = runner.invoke( view, ["dummysecret", "--env", "dummyenv", "--config", "dummyconfig"], ) assert result.exit_code == 0 mocked_create_namespace_if_not_exists.assert_called_once_with( "dummy_layer") mocked_get_secrets.assert_called_once_with("dummy_layer", "manual-secrets") mocked_layer.assert_called_once_with("dummyconfig", "dummyenv", input_variables={}, strict_input_variables=False) mocked_amplitude_client.send_event.assert_called_once_with( amplitude_client.VIEW_SECRET_EVENT, event_properties={ "org_name": "dummy_org_name", "layer_name": "dummy_layer" }, )
def test_custom_process_template(app_context: AppContext, mocker: MockFixture) -> None: """Test macro defined in custom template processor works.""" mock_dt = mocker.patch( "tests.integration_tests.superset_test_custom_template_processors.datetime" ) mock_dt.utcnow = mock.Mock(return_value=datetime(1970, 1, 1)) db = mock.Mock() db.backend = "db_for_macros_testing" tp = get_template_processor(database=db) template = "SELECT '$DATE()'" assert tp.process_template(template) == f"SELECT '1970-01-01'" template = "SELECT '$DATE(1, 2)'" assert tp.process_template(template) == "SELECT '1970-01-02'"
def test_init_setup(with_scenarios, mocker: MockFixture): mock_resolve = mocker.patch("pydngconverter.compat.resolve_executable") mock_resolve.return_value = Path(""), "" dng = pydng.DNGConverter(*with_scenarios[0], **with_scenarios[-1]) dng_call = mocker.call(["Adobe DNG Converter", "dngconverter"], "PYDNG_DNG_CONVERTER") exif_call = mocker.call(["exiftool"], "PYDNG_EXIF_TOOL") if dng.parameters.jpeg_preview == flags.JPEGPreview.NONE: mock_resolve.assert_has_calls([dng_call]) mock_resolve.assert_called_once() if dng.parameters.jpeg_preview == flags.JPEGPreview.MEDIUM: mock_resolve.assert_has_calls([dng_call]) mock_resolve.assert_called_once() if dng.parameters.jpeg_preview == flags.JPEGPreview.EXTRACT: mock_resolve.assert_has_calls([dng_call, exif_call]) assert mock_resolve.call_count == 2
async def test_ok_signs(self, mocker: MockFixture, fake_model_data_provider: ModelDataProvider): fake_filter_name = mocker.Mock() fake_filter_value = mocker.Mock() mocked_search = mocker.patch('re.search') compared_operator = fake_model_data_provider.get_comparison_operator( fake_filter_name, fake_filter_value) expected_operator = mocked_search.return_value.group.return_value assert compared_operator == expected_operator mocked_search.assert_called_once_with( '__({})$'.format(fake_model_data_provider.COMPARISON_SIGNS), fake_filter_name) mocked_search.return_value.group.assert_called_once_with(1)
def test_get_ecr_auth_info(mocker: MockFixture) -> None: mocked_layer = mocker.Mock(spec=Layer) mocked_layer.gen_providers = lambda x: BASIC_APPLY[1] mocked_ecr_client = mocker.Mock() def mock_get_authorization_token(registryIds: List[str]) -> Dict[str, Any]: decoded_auth_token = "username:password" auth_token_bytes = decoded_auth_token.encode() b64_auth_token = base64.b64encode(auth_token_bytes) return {"authorizationData": [{"authorizationToken": b64_auth_token}]} mocked_ecr_client.get_authorization_token = mock_get_authorization_token patched_boto_client = mocker.patch("opta.commands.push.boto3.client") patched_boto_client.return_value = mocked_ecr_client assert get_ecr_auth_info(mocked_layer) == ("username", "password",)
def test_orca_mock(mocker: MockFixture): """Mock a call to orca.""" methanol = Molecule(PATH_MOLECULES / "methanol.xyz") s = Settings() s.specific.orca.main = "RKS B3LYP SVP Opt NumFreq TightSCF SmallPrint" # print the orbitals s.specific.orca.scf = " print[p_mos] 1" job = orca(s, methanol) run_mocked = mocker.patch("qmflows.run") jobname = "ORCAjob" dill_path = WORKDIR / jobname / "ORCAjob.dill" plams_dir = WORKDIR / jobname run_mocked.return_value = ORCA_Result(s, methanol, jobname, dill_path=dill_path, plams_dir=plams_dir) rs = run_mocked(job) assertion.isfinite(rs.energy) assertion.isfinite(rs.runtime) assertion.isfinite(np.sum(rs.dipole)) # steps until convergence assertion.eq(rs.optcycles, 8) # Check that hessian is symmetric hess = rs.hessian assertion.isclose(np.sum(hess - hess.T), 0.0) # frequencies frequencies = rs.frequencies assertion.len_eq(frequencies, 18) # Normal modes normal_modes = rs.normal_modes assertion.shape_eq(normal_modes, (18, 18)) # Orbitals orbs = rs.orbitals assert np.isfinite(np.sum(orbs.eigenvalues)) # eigenvalues # Molecule mol = rs.molecule assertion.isinstance(mol, Molecule) assertion.len_eq(mol, 6) # there are 6 atoms