Skip to content

Commit

Permalink
Python test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikahanninen committed Dec 8, 2024
1 parent ff24587 commit 53dc221
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion packages/main/tests/python/test_crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def test_set_key_vault_error_empty():
lib = Crypto()
lib._vault = mock_vault = mock.Mock()

key = lib.generate_key()
_ = lib.generate_key()
mock_vault.get_secret.return_value = Secret("MockSecret", "", {})

with pytest.raises(ValueError):
Expand Down
2 changes: 1 addition & 1 deletion packages/main/tests/python/test_documentai.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def test_get_matching_signatures(
self, mock_requests, library, input_files, source, field_ending
):
files = input_files[source]
sigs = library.get_matching_signatures(
_ = library.get_matching_signatures(
files["driving-license"], files["payment-check"]
)
args, kwargs = mock_requests.post.call_args
Expand Down
4 changes: 2 additions & 2 deletions packages/main/tests/python/test_excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,14 @@ def test_set_worksheet_value(library):
assert row["C"] == "Third"


def test_get_worksheet_value(library):
def test_get_cell_value(library):
assert library.get_cell_value(5, "A") == 4
assert library.get_cell_value(5, "C") == 3549
assert library.get_cell_value(3, 3) == 1582
assert library.get_cell_value(9, "E", "First") == "United States"


def test_set_worksheet_value(library):
def test_set_cell_value(library):
library.set_cell_value(11, "A", "First")
library.set_cell_value(11, 2, "Second")
library.set_cell_value(11, "3", "Third", fmt="00.0")
Expand Down
2 changes: 1 addition & 1 deletion packages/main/tests/python/test_images.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
from pathlib import Path
from RPA.Images import Images, TemplateMatcher, Region, to_image, HAS_RECOGNITION
from RPA.Images import Images, Region, HAS_RECOGNITION

IMAGES = Path(__file__).resolve().parent / ".." / "resources" / "images"

Expand Down
4 changes: 2 additions & 2 deletions packages/main/tests/python/test_imapsmtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

import pytest
from RPA.Email.ImapSmtp import ImapSmtp
from RPA.Email.common import counter_duplicate_path, NoRecipientsError
from RPA.Email.common import counter_duplicate_path
from docx import Document

from . import RESOURCES_DIR


class Resources:
image = RESOURCES_DIR / "approved.png"
email = RESOURCES_DIR / "emails" / f"work-item-documentation.eml"
email = RESOURCES_DIR / "emails" / "work-item-documentation.eml"


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion packages/main/tests/python/test_robocorp_vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def test_adapter_filesecrets_unknown_secret(monkeypatch, secrets_file):

adapter = FileSecrets()
with pytest.raises(KeyError):
secret = adapter.get_secret("not-exist")
_ = adapter.get_secret("not-exist")


def test_adapter_filesecrets_saving(monkeypatch, tmp_path, secrets_file):
Expand Down
52 changes: 26 additions & 26 deletions packages/main/tests/python/test_smartsheet.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,6 @@
import os
from itertools import chain
from json.encoder import JSONEncoder
from pathlib import Path
from typing import Iterable, List, Union

import pytest
import smartsheet.smartsheet as smart_sdk
from mock import MagicMock, patch
from pytest_mock import MockerFixture
from requests.models import PreparedRequest, Response

OperationResult = smart_sdk.OperationResult
OperationErrorResult = smart_sdk.OperationErrorResult

import RPA.Smartsheet as ss
from RPA.Tables import Table

Smartsheet = ss.Smartsheet

# You can set a personal testing token via the smartsheet_testvars.py file
try:
from .smartsheet_testvars import ACCESS_TOKEN

VARS = True
except ImportError:
VARS = False

# Import mock data
from .smartsheet_vars import (
ITEM_COLUMN_ID,
Expand All @@ -49,6 +24,31 @@
UPDATED_ROWS,
ZIP_COLUMN_ID,
)
from itertools import chain
from json.encoder import JSONEncoder
from pathlib import Path
from typing import Iterable, List, Union

import pytest
import smartsheet.smartsheet as smart_sdk
from mock import MagicMock
from pytest_mock import MockerFixture
from requests.models import PreparedRequest, Response

OperationResult = smart_sdk.OperationResult
OperationErrorResult = smart_sdk.OperationErrorResult

Smartsheet = ss.Smartsheet

# You can set a personal testing token via the smartsheet_testvars.py file
try:
from .smartsheet_testvars import ACCESS_TOKEN

VARS = True
except ImportError:
VARS = False



# Testing Constants
TEMP_DIR = Path(__file__).parent.parent / "results"
Expand All @@ -60,7 +60,7 @@ def test_debugging():
"""This test should always be skipped for automated tests."""
lib = Smartsheet(access_token=ACCESS_TOKEN)
orders = lib.get_sheet(sheet_name="orders", native=True)
revisions = lib.get_cell_history(row=orders.rows[0], column=orders.columns[0])
_ = lib.get_cell_history(row=orders.rows[0], column=orders.columns[0])
attachments = lib.list_attachments()
for a in attachments:
lib.download_attachment(a, TEMP_DIR)
Expand Down
4 changes: 2 additions & 2 deletions packages/main/tests/python/test_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def test_table_negative_row_index(table):

def test_table_negative_column_index(table):
assert table[0, 1] == 2
assert table[0, -1] == None
assert table[0, -1] is None
assert table[0, -2] == 3


Expand Down Expand Up @@ -645,7 +645,7 @@ def test_import_with_integer_keys():

table = Table(data)
assert table.dimensions == (3, 3)
assert table[0, 0] == None
assert table[0, 0] is None

table = Table(data, columns=("Field", "Value"))
assert table.dimensions == (3, 2)
Expand Down

0 comments on commit 53dc221

Please sign in to comment.