repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
redis/redis-om-python | import abc
import datetime
import decimal
from collections import namedtuple
from typing import Optional
import pytest
import pytest_asyncio
from aredis_om import HashModel, Migrator, NotFoundError, RedisModelError
from tests._compat import ValidationError
from .conftest import py_test_mark_asyncio
today = datetime... | RedisModelError) | pytest.raises | variable | tests/test_oss_redis_features.py | test_raises_error_with_embedded_models | 147 | null | |
redis/redis-om-python | import abc
import struct
from typing import Optional, Type
import pytest
import pytest_asyncio
from aredis_om import Field, JsonModel, KNNExpression, Migrator, VectorFieldOptions
from redis_om import has_redis_json
from .conftest import py_test_mark_asyncio
DIMENSIONS = 768
vector_field_options = VectorFieldOptio... | None | assert | none_literal | tests/test_knn_expression.py | test_vector_field | 90 | null | |
redis/redis-om-python | from datetime import datetime
from enum import Enum
from typing import List, Optional
import pytest
from aredis_om import (
EmbeddedJsonModel,
Field,
HashModel,
JsonModel,
Migrator,
NotFoundError,
)
from .conftest import py_test_mark_asyncio
async def run_migrations():
"""Run migrations ... | 30 | assert | numeric_literal | tests/test_examples.py | test_user_hashmodel_crud | 126 | null | |
redis/redis-om-python | import abc
import dataclasses
import datetime
import decimal
import uuid
from collections import namedtuple
from typing import Dict, List, Optional, Set, Union
from unittest import mock
import pytest
import pytest_asyncio
from aredis_om import (
EmbeddedJsonModel,
Field,
FindQuery,
HashModel,
Json... | [ "FT.SEARCH", model_name, "@age:[(0 +inf]", "LIMIT", 0, 1000, "SORTBY", "age", "asc", ] | assert | collection | tests/test_find_query.py | test_find_query_sort | 231 | null | |
redis/redis-om-python | import abc
import dataclasses
import datetime
import decimal
import uuid
from collections import namedtuple
from typing import Dict, List, Optional, Set, Union
from unittest import mock
import pytest
import pytest_asyncio
from aredis_om import (
EmbeddedJsonModel,
Field,
FindQuery,
HashModel,
Json... | ["FT.SEARCH", model_name, "@first_name:{Andrew}", "LIMIT", 1, 1] | assert | collection | tests/test_find_query.py | test_find_query_limit_offset | 409 | null | |
redis/redis-om-python | import abc
import pytest
import pytest_asyncio
from aredis_om import Field, HashModel, JsonModel, Migrator
from aredis_om.model.model import SINGLE_VALUE_TAG_FIELD_SEPARATOR
from redis_om import has_redisearch
from .conftest import py_test_mark_asyncio
class TestFieldSeparatorParameter:
def test_field_default... | "|" | assert | string_literal | tests/test_tag_separator.py | test_field_default_separator_is_pipe | TestFieldSeparatorParameter | 40 | null |
redis/redis-om-python | import abc
import datetime
import decimal
from collections import namedtuple
from typing import Optional
import pytest
import pytest_asyncio
from aredis_om import HashModel, Migrator, NotFoundError, RedisModelError
from tests._compat import ValidationError
from .conftest import py_test_mark_asyncio
today = datetime... | sorted([m.pk for m in members]) | assert | func_call | tests/test_oss_redis_features.py | test_all_keys | 88 | null | |
redis/redis-om-python | import abc
import datetime
from collections import namedtuple
from typing import Optional
import pytest
import pytest_asyncio
from pydantic import field_validator
from aredis_om import Field, HashModel, Migrator
from tests._compat import EmailStr, ValidationError
today = datetime.date.today()
async def m(key_prefix... | ValidationError) | pytest.raises | variable | tests/test_pydantic_integrations.py | test_email_str | 36 | null | |
redis/redis-om-python | import abc
from enum import Enum, IntEnum
from typing import Optional
import pytest
import pytest_asyncio
from aredis_om import Field, HashModel, JsonModel, Migrator
from redis_om import has_redisearch
from .conftest import py_test_mark_asyncio
async def models_for_bug_fixes(key_prefix, redis):
"""Fixture prov... | 2 | assert | numeric_literal | tests/test_bug_fixes.py | test_issue_108_enum_int_in_query | 111 | null | |
redis/redis-om-python | import abc
import dataclasses
import datetime
import decimal
import uuid
from collections import namedtuple
from typing import Dict, List, Optional, Set, Union
from unittest import mock
import pytest
import pytest_asyncio
from aredis_om import (
Coordinates,
Field,
GeoFilter,
HashModel,
Migrator,
... | 2 | assert | numeric_literal | tests/test_hash_model.py | test_delete_many | 693 | null | |
redis/redis-om-python | import abc
import dataclasses
import datetime
import decimal
import uuid
from collections import namedtuple
from enum import Enum
from typing import Dict, List, Optional, Set, Union
from unittest import mock
import pytest
import pytest_asyncio
from aredis_om import (
Coordinates,
EmbeddedJsonModel,
Field,... | 1 | assert | numeric_literal | tests/test_json_model.py | test_delete | 304 | null | |
redis/redis-om-python | import abc
import pytest
import pytest_asyncio
from aredis_om import Field, HashModel, JsonModel, Migrator
from aredis_om.model.model import SINGLE_VALUE_TAG_FIELD_SEPARATOR
from redis_om import has_redisearch
from .conftest import py_test_mark_asyncio
async def separator_models(key_prefix, redis):
"""Fixture ... | 2 | assert | numeric_literal | tests/test_tag_separator.py | test_hash_model_query_individual_tag_with_custom_separator | TestEndToEndWithCustomSeparator | 181 | null |
redis/redis-om-python | import datetime
import pytest
from aredis_om import Field
from aredis_om.model.model import HashModel, JsonModel
from redis_om import has_redis_json
from .conftest import py_test_mark_asyncio
@py_test_mark_asyncio
async def test_hash_model_date_conversion(redis):
"""Test date conversion in HashModel."""
# ... | test_date | assert | variable | tests/test_datetime_date_fix.py | test_hash_model_date_conversion | 67 | null | |
redis/redis-om-python | import abc
import dataclasses
import datetime
import decimal
import uuid
from collections import namedtuple
from enum import Enum
from typing import Dict, List, Optional, Set, Union
from unittest import mock
import pytest
import pytest_asyncio
from aredis_om import (
Coordinates,
EmbeddedJsonModel,
Field,... | 42 | assert | numeric_literal | tests/test_json_model.py | test_update_validation | 1,134 | null | |
redis/redis-om-python | import abc
import dataclasses
import datetime
import decimal
import uuid
from collections import namedtuple
from typing import Dict, List, Optional, Set, Union
from unittest import mock
import pytest
import pytest_asyncio
from aredis_om import (
EmbeddedJsonModel,
Field,
FindQuery,
HashModel,
Json... | ["FT.SEARCH", model_name, "@age:[-inf (40]", "LIMIT", 0, 1000] | assert | collection | tests/test_find_query.py | test_find_query_lt | 198 | null | |
redis/redis-om-python | import abc
import dataclasses
import datetime
import decimal
import uuid
from collections import namedtuple
from enum import Enum
from typing import Dict, List, Optional, Set, Union
from unittest import mock
import pytest
import pytest_asyncio
from aredis_om import (
Coordinates,
EmbeddedJsonModel,
Field,... | 10 | assert | numeric_literal | tests/test_json_model.py | test_pagination | 1,218 | null | |
redis/redis-om-python | import abc
import dataclasses
import datetime
import decimal
import uuid
from collections import namedtuple
from typing import Dict, List, Optional, Set, Union
from unittest import mock
import pytest
import pytest_asyncio
from aredis_om import (
Coordinates,
Field,
GeoFilter,
HashModel,
Migrator,
... | 18 | assert | numeric_literal | tests/test_hash_model.py | test_child_class_expression_proxy | 981 | null | |
redis/redis-om-python | from datetime import datetime
from enum import Enum
from typing import List, Optional
import pytest
from aredis_om import (
EmbeddedJsonModel,
Field,
HashModel,
JsonModel,
Migrator,
NotFoundError,
)
from .conftest import py_test_mark_asyncio
async def run_migrations():
"""Run migrations ... | retrieved.tags | assert | complex_expr | tests/test_examples.py | test_product_jsonmodel_crud | 194 | null | |
redis/redis-om-python | import abc
import dataclasses
import datetime
import decimal
import uuid
from collections import namedtuple
from enum import Enum
from typing import Dict, List, Optional, Set, Union
from unittest import mock
import pytest
import pytest_asyncio
from aredis_om import (
Coordinates,
EmbeddedJsonModel,
Field,... | 19 | assert | numeric_literal | tests/test_json_model.py | test_child_class_expression_proxy | 1,280 | null | |
redis/redis-om-python | from datetime import datetime
from enum import Enum
from typing import List, Optional
import pytest
from aredis_om import (
EmbeddedJsonModel,
Field,
HashModel,
JsonModel,
Migrator,
NotFoundError,
)
from .conftest import py_test_mark_asyncio
async def run_migrations():
"""Run migrations ... | 2 | assert | numeric_literal | tests/test_examples.py | test_product_jsonmodel_queries | 215 | null | |
redis/redis-om-python | import abc
import datetime
import decimal
from collections import namedtuple
from typing import Optional
import pytest
import pytest_asyncio
from aredis_om import HashModel, Migrator, NotFoundError, RedisModelError
from tests._compat import ValidationError
from .conftest import py_test_mark_asyncio
today = datetime... | member2 | assert | variable | tests/test_oss_redis_features.py | test_saves_many | 176 | null | |
redis/redis-om-python | import abc
from enum import Enum, IntEnum
from typing import Optional
import pytest
import pytest_asyncio
from aredis_om import Field, HashModel, JsonModel, Migrator
from redis_om import has_redisearch
from .conftest import py_test_mark_asyncio
async def models_for_bug_fixes(key_prefix, redis):
"""Fixture prov... | None | assert | none_literal | tests/test_bug_fixes.py | test_issue_254_optional_field_retrieval | 133 | null | |
redis/redis-om-python | import abc
import dataclasses
import datetime
import decimal
import uuid
from collections import namedtuple
from enum import Enum
from typing import Dict, List, Optional, Set, Union
from unittest import mock
import pytest
import pytest_asyncio
from aredis_om import (
Coordinates,
EmbeddedJsonModel,
Field,... | 18 | assert | numeric_literal | tests/test_json_model.py | test_child_class_expression_proxy | 1,275 | null | |
redis/redis-om-python | import abc
import dataclasses
import datetime
import decimal
import uuid
from collections import namedtuple
from typing import Dict, List, Optional, Set, Union
from unittest import mock
import pytest
import pytest_asyncio
from aredis_om import (
EmbeddedJsonModel,
Field,
FindQuery,
HashModel,
Json... | ["FT.SEARCH", model_name, "@age:[-inf 38]", "LIMIT", 0, 1000] | assert | collection | tests/test_find_query.py | test_find_query_le | 206 | null | |
redis/redis-om-python | import abc
from typing import Optional
import pytest
import pytest_asyncio
from redisvl.index import AsyncSearchIndex, SearchIndex
from redisvl.schema import IndexSchema
from aredis_om import Field, HashModel, JsonModel, Migrator, VectorFieldOptions
from aredis_om.redisvl import get_redisvl_index, to_redisvl_schema
... | ValueError, match="is not indexed") | pytest.raises | complex_expr | tests/test_redisvl_integration.py | test_to_redisvl_schema_non_indexed_raises | 132 | null | |
redis/redis-om-python | import abc
from enum import Enum, IntEnum
from typing import Optional
import pytest
import pytest_asyncio
from aredis_om import Field, HashModel, JsonModel, Migrator
from redis_om import has_redisearch
from .conftest import py_test_mark_asyncio
async def models_for_bug_fixes(key_prefix, redis):
"""Fixture prov... | 20 | assert | numeric_literal | tests/test_bug_fixes.py | test_issue_254_optional_field_retrieval | 132 | null | |
redis/redis-om-python | import abc
import pytest
import pytest_asyncio
from aredis_om import Field, HashModel, JsonModel, Migrator
from aredis_om.model.model import SINGLE_VALUE_TAG_FIELD_SEPARATOR
from redis_om import has_redisearch
from .conftest import py_test_mark_asyncio
class TestFieldSeparatorParameter:
def test_field_accepts... | "," | assert | string_literal | tests/test_tag_separator.py | test_field_accepts_separator_parameter | TestFieldSeparatorParameter | 33 | null |
redis/redis-om-python | import abc
from typing import Optional
import pytest
import pytest_asyncio
from redisvl.index import AsyncSearchIndex, SearchIndex
from redisvl.schema import IndexSchema
from aredis_om import Field, HashModel, JsonModel, Migrator, VectorFieldOptions
from aredis_om.redisvl import get_redisvl_index, to_redisvl_schema
... | "hash" | assert | string_literal | tests/test_redisvl_integration.py | test_to_redisvl_schema_hash_model | 118 | null | |
redis/redis-om-python | import abc
import datetime
import decimal
from collections import namedtuple
from typing import Optional
import pytest
import pytest_asyncio
from aredis_om import HashModel, Migrator, NotFoundError, RedisModelError
from tests._compat import ValidationError
from .conftest import py_test_mark_asyncio
today = datetime... | "Andrew" | assert | string_literal | tests/test_oss_redis_features.py | test_validation_passes | 120 | null | |
redis/redis-om-python | import hashlib
import os
import tempfile
from unittest.mock import AsyncMock, patch
import pytest
from aredis_om.model.migrations.schema import BaseSchemaMigration, SchemaMigrator
from aredis_om.model.migrations.schema.legacy_migrator import (
schema_hash_key,
schema_text_key,
)
def get_worker_id():
"""G... | Exception) | pytest.raises | variable | tests/test_schema_migrator.py | test_rollback_with_empty_previous_schema | 308 | null | |
redis/redis-om-python | import os
import subprocess
import sys
import tempfile
def test_migrate_status_and_run_and_create_cli():
with tempfile.TemporaryDirectory() as tmp:
env = os.environ.copy()
env["REDIS_OM_MIGRATIONS_DIR"] = tmp
env["REDIS_OM_URL"] = "redis://localhost:6380?decode_responses=True"
# st... | 0 | assert | numeric_literal | tests/test_cli_migrate.py | test_migrate_status_and_run_and_create_cli | 21 | null | |
redis/redis-om-python | import abc
from enum import Enum, IntEnum
from typing import Optional
import pytest
import pytest_asyncio
from aredis_om import Field, HashModel, JsonModel, Migrator
from redis_om import has_redisearch
from .conftest import py_test_mark_asyncio
async def models_for_bug_fixes(key_prefix, redis):
"""Fixture prov... | {"Task A", "Task C"} | assert | collection | tests/test_bug_fixes.py | test_issue_108_enum_with_in_operator | 218 | null | |
redis/redis-om-python | import abc
import struct
from typing import Optional, Type
import pytest
import pytest_asyncio
from aredis_om import Field, JsonModel, KNNExpression, Migrator, VectorFieldOptions
from redis_om import has_redis_json
from .conftest import py_test_mark_asyncio
DIMENSIONS = 768
vector_field_options = VectorFieldOptio... | 1 | assert | numeric_literal | tests/test_knn_expression.py | test_vector_field | 89 | null | |
gee-community/geetools | import ee
import pytest
class TestInteger:
def test_init(self):
with pytest.raises( | NotImplementedError) | pytest.raises | variable | tests/test_Integer.py | test_init | TestInteger | 10 | null |
gee-community/geetools | import ee
import pytest
class TestSplit:
def test_split(self, daterange_instance):
list = daterange_instance.geetools.split(1, "day")
first = ee.DateRange(list.get(0)).start()
last = ee.DateRange(list.get(-1)).end()
assert list.size().getInfo() == 30
assert first.format("YY... | "2020-01-31" | assert | string_literal | tests/test_DateRange.py | test_split | TestSplit | 15 | null |
gee-community/geetools | import ee
class TestSet:
def test_set_with_integers(self):
array = ee.Array.geetools.full(3, 3, 1)
set_array = array.geetools.set(1, 1, 0)
assert set_array.getInfo() == | [[1, 1, 1], [1, 0, 1], [1, 1, 1]] | assert | collection | tests/test_Array.py | test_set_with_integers | TestSet | 31 | null |
gee-community/geetools | import os
import ee
import pytest
import geetools # noqa F401
EARTHENGINE_PROJECT = os.environ.get("EARTHENGINE_PROJECT")
pytestmark = pytest.mark.skip(reason="The tests are way to slow")
class TestProperties:
def test_st_size(self, gee_test_folder):
gee_test_folder = ee.Asset(gee_test_folder)
... | 31 | assert | numeric_literal | tests/test_Asset.py | test_st_size | TestProperties | 158 | null |
gee-community/geetools | from datetime import datetime as dt
from zoneinfo import ZoneInfo
import ee
import pytest
import geetools # noqa: F401
class TestToDOY:
def test_to_doy_leap(self):
doy = ee.Date("2020-03-01").geetools.toDOY()
assert doy.getInfo() == | 60 | assert | numeric_literal | tests/test_Date.py | test_to_doy_leap | TestToDOY | 77 | null |
gee-community/geetools | from __future__ import annotations
import io
import sys
import ee
import numpy as np
import pytest
from ee.ee_exception import EEException
from jsonschema import validate
from matplotlib import pyplot as plt
def reduce(
collection: ee.ImageCollection, geometry: ee.Geometry | None = None, reducer: str = "first"
)... | 24 | assert | numeric_literal | tests/test_ImageCollection.py | test_group_interval_with_interval_and_unit | TestGroupInterval | 303 | null |
gee-community/geetools | from datetime import datetime as dt
from zoneinfo import ZoneInfo
import ee
import pytest
import geetools # noqa: F401
class TestToDatetime:
def test_to_datetime_str_timezone(self, date_instance):
str_tz = "America/Buenos_Aires"
py_dt = date_instance.geetools.to_datetime(str_tz)
# Bueno... | dt(2019, 12, 31, 21, tzinfo=ZoneInfo(str_tz)) | assert | func_call | tests/test_Date.py | test_to_datetime_str_timezone | TestToDatetime | 28 | null |
gee-community/geetools | import io
import zipfile
from io import BytesIO
from math import isclose
from pathlib import Path
from tempfile import TemporaryDirectory
from urllib.request import urlretrieve
import ee
import numpy as np
import pytest
from jsonschema import validate
from matplotlib import pyplot as plt
import geetools # noqa: F401... | image.propertyNames().getInfo() | assert | func_call | tests/test_Image.py | test_full_like | TestFullLike | 177 | null |
gee-community/geetools | from datetime import datetime as dt
from zoneinfo import ZoneInfo
import ee
import pytest
import geetools # noqa: F401
class TestToDOY:
def test_to_doy(self):
doy = ee.Date("2025-04-09").geetools.toDOY()
assert doy.getInfo() == | 99 | assert | numeric_literal | tests/test_Date.py | test_to_doy | TestToDOY | 73 | null |
gee-community/geetools | from __future__ import annotations
import io
import sys
import ee
import numpy as np
import pytest
from ee.ee_exception import EEException
from jsonschema import validate
from matplotlib import pyplot as plt
def reduce(
collection: ee.ImageCollection, geometry: ee.Geometry | None = None, reducer: str = "first"
)... | AttributeError) | pytest.raises | variable | tests/test_ImageCollection.py | test_reduce_interval_with_non_existing_reducer_and_properties | TestReduceInterval | 357 | null |
gee-community/geetools | import geetools # noqa: F401
class TestIsClose:
def test_is_close(self, number_instance):
is_close = number_instance.geetools.isClose(1234.56785678)
assert is_close.getInfo() == | 1 | assert | numeric_literal | tests/test_Number.py | test_is_close | TestIsClose | 30 | null |
gee-community/geetools | from datetime import datetime as dt
from zoneinfo import ZoneInfo
import ee
import pytest
import geetools # noqa: F401
class TestFromDOY:
def test_wrong_year(self):
# check GEE can use year < EPOCH
date = ee.Date.geetools.fromDOY(1, 3)
assert date.format("YYYY-MM-DD").getInfo() == | "0003-01-01" | assert | string_literal | tests/test_Date.py | test_wrong_year | TestFromDOY | 65 | null |
gee-community/geetools | import ee
import pytest
class TestIsinstance:
def test_isinstance_with_string(self):
assert ee.String("").isInstance(ee.String).getInfo() == | 1 | assert | numeric_literal | tests/test_ComputedObect.py | test_isinstance_with_string | TestIsinstance | 11 | null |
gee-community/geetools | import ee
import pytest
class TestCheckUnit:
def test_check_unit(self):
with pytest.raises( | ValueError) | pytest.raises | variable | tests/test_DateRange.py | test_check_unit | TestCheckUnit | 30 | null |
gee-community/geetools | import geetools # noqa: F401
class TestTruncate:
def test_truncate_with_custom_decimals(self, number_instance):
truncated_number = number_instance.geetools.truncate(1)
assert truncated_number.getInfo() == | 1234.5 | assert | numeric_literal | tests/test_Number.py | test_truncate_with_custom_decimals | TestTruncate | 14 | null |
gee-community/geetools | import ee
import geetools # noqa: F401
class TestSequence:
def test_sequence(self):
seq = ee.List.geetools.sequence(1, 10)
assert seq.getInfo() == | list(range(1, 11)) | assert | func_call | tests/test_List.py | test_sequence | TestSequence | 68 | null |
gee-community/geetools | import ee
class TestFormat:
def test_format_formatter(self):
string = ee.String(
"{greeting} developer, pi={number%.2f} start={start%tyyyy-MM-dd} end={end%tdd MMM yyyy}"
)
params = {
"greeting": "Hello",
"number": 3.1415,
"start": 15778368000... | "Hello developer, pi=3.14 start=2020-01-01 end=01 Jan 2021" | assert | string_literal | tests/test_String.py | test_format_formatter | TestFormat | 41 | null |
gee-community/geetools | import io
import zipfile
from io import BytesIO
from math import isclose
from pathlib import Path
from tempfile import TemporaryDirectory
from urllib.request import urlretrieve
import ee
import numpy as np
import pytest
from jsonschema import validate
from matplotlib import pyplot as plt
import geetools # noqa: F401... | "COPERNICUS/S2_SR_HARMONIZED" | assert | string_literal | tests/test_Image.py | test_get_stac | TestGetSTAC | 480 | null |
gee-community/geetools | from geetools import utils
class TestFormatAssetID:
def test_replacements(self):
"""Test replacements."""
description = "Testing / replacements ?!{}()"
result = utils.format_asset_id(description)
assert result == | "Testing_-_replacements_______" | assert | string_literal | tests/test_batch/test_utils.py | test_replacements | TestFormatAssetID | 45 | null |
gee-community/geetools | import ee
import pytest
class TestSplit:
def test_split(self, daterange_instance):
list = daterange_instance.geetools.split(1, "day")
first = ee.DateRange(list.get(0)).start()
last = ee.DateRange(list.get(-1)).end()
assert list.size().getInfo() == | 30 | assert | numeric_literal | tests/test_DateRange.py | test_split | TestSplit | 13 | null |
gee-community/geetools | from __future__ import annotations
import io
import sys
import ee
import numpy as np
import pytest
from ee.ee_exception import EEException
from jsonschema import validate
from matplotlib import pyplot as plt
def reduce(
collection: ee.ImageCollection, geometry: ee.Geometry | None = None, reducer: str = "first"
)... | 1440 | assert | numeric_literal | tests/test_ImageCollection.py | test_group_interval_with_interval | TestGroupInterval | 295 | null |
gee-community/geetools | from __future__ import annotations
import io
import sys
import ee
import numpy as np
import pytest
from ee.ee_exception import EEException
from jsonschema import validate
from matplotlib import pyplot as plt
def reduce(
collection: ee.ImageCollection, geometry: ee.Geometry | None = None, reducer: str = "first"
)... | "COPERNICUS/S2_SR_HARMONIZED" | assert | string_literal | tests/test_ImageCollection.py | test_get_stac | TestGetSTAC | 98 | null |
gee-community/geetools | import ee
class TestEq:
def test_eq_with_same_string(self, string_instance):
eq_number = string_instance.geetools.eq("foo")
assert eq_number.getInfo() == | 1 | assert | numeric_literal | tests/test_String.py | test_eq_with_same_string | TestEq | 10 | null |
gee-community/geetools | from geetools import utils
class TestFormatAssetID:
def test_long_description(self):
description = "A" * 150
result = utils.format_asset_id(description)
assert len(result) == | 150 | assert | numeric_literal | tests/test_batch/test_utils.py | test_long_description | TestFormatAssetID | 50 | null |
gee-community/geetools | import ee
class TestFormat:
def test_with_number(self, format_string_instance):
params = {"greeting": "Hello", "name": ee.Number(1)}
formatted_string = format_string_instance.geetools.format(params)
assert formatted_string.getInfo() == | "Hello 1 !" | assert | string_literal | tests/test_String.py | test_with_number | TestFormat | 28 | null |
gee-community/geetools | import io
import zipfile
from io import BytesIO
from math import isclose
from pathlib import Path
from tempfile import TemporaryDirectory
from urllib.request import urlretrieve
import ee
import numpy as np
import pytest
from jsonschema import validate
from matplotlib import pyplot as plt
import geetools # noqa: F401... | 247 | assert | numeric_literal | tests/test_Image.py | test_indices | TestIndicexList | 415 | null |
gee-community/geetools | import ee
class TestEq:
def test_eq_with_different_string(self, string_instance):
eq_number = string_instance.geetools.eq("bar")
assert eq_number.getInfo() == | 0 | assert | numeric_literal | tests/test_String.py | test_eq_with_different_string | TestEq | 14 | null |
gee-community/geetools | from datetime import datetime as dt
from zoneinfo import ZoneInfo
import ee
import pytest
import geetools # noqa: F401
class TestToDatetime:
def test_to_datetime(self, date_instance):
py_dt = date_instance.geetools.to_datetime()
assert py_dt == | dt(2020, 1, 1, tzinfo=ZoneInfo("UTC")) | assert | func_call | tests/test_Date.py | test_to_datetime | TestToDatetime | 16 | null |
gee-community/geetools | import io
import zipfile
from io import BytesIO
from math import isclose
from pathlib import Path
from tempfile import TemporaryDirectory
from urllib.request import urlretrieve
import ee
import numpy as np
import pytest
from jsonschema import validate
from matplotlib import pyplot as plt
import geetools # noqa: F401... | indices.keys() | assert | func_call | tests/test_Image.py | test_indices | TestIndicexList | 414 | null |
gee-community/geetools | import io
import ee
import geopandas as gpd
import pytest
from matplotlib import pyplot as plt
import geetools # noqa: F401
class TestFromGeoInterface:
def test_error_from_geo_interface_(self):
with pytest.raises( | ValueError) | pytest.raises | variable | tests/test_FeatureCollection.py | test_error_from_geo_interface_ | TestFromGeoInterface | 331 | null |
gee-community/geetools | from datetime import datetime as dt
from zoneinfo import ZoneInfo
import ee
import pytest
import geetools # noqa: F401
class TestIsLeap:
def test_is_leap_1900(self):
leap = ee.Date("1900-01-01").geetools.isLeap()
assert leap.getInfo() == | 0 | assert | numeric_literal | tests/test_Date.py | test_is_leap_1900 | TestIsLeap | 97 | null |
gee-community/geetools | import ee
class TestFull:
def test_full_with_floats(self):
full_array = ee.Array.geetools.full(3.1, 3.1, 1.0)
assert full_array.getInfo() == | [ [1.0, 1.0, 1.0], [1.0, 1.0, 1.0], [1.0, 1.0, 1.0], ] | assert | collection | tests/test_Array.py | test_full_with_floats | TestFull | 14 | null |
gee-community/geetools | from __future__ import annotations
import io
import sys
import ee
import numpy as np
import pytest
from ee.ee_exception import EEException
from jsonschema import validate
from matplotlib import pyplot as plt
def reduce(
collection: ee.ImageCollection, geometry: ee.Geometry | None = None, reducer: str = "first"
)... | ic.propertyNames().getInfo() | assert | func_call | tests/test_ImageCollection.py | test_reduce_interval_image_collection_with_system_id | TestReduceInterval | 368 | null |
gee-community/geetools | import io
import zipfile
from io import BytesIO
from math import isclose
from pathlib import Path
from tempfile import TemporaryDirectory
from urllib.request import urlretrieve
import ee
import numpy as np
import pytest
from jsonschema import validate
from matplotlib import pyplot as plt
import geetools # noqa: F401... | ValueError) | pytest.raises | variable | tests/test_Image.py | test_pixel_area_error | TestPixelArea | 943 | null |
gee-community/geetools | from geetools import utils
class TestFormatAssetID:
def test_unicode_characters(self):
description = "Unicode characters like é, ä, and ñ should be changed"
result = utils.format_asset_id(description)
assert result == | "Unicode_characters_like_e__a__and_n_should_be_changed" | assert | string_literal | tests/test_batch/test_utils.py | test_unicode_characters | TestFormatAssetID | 55 | null |
gee-community/geetools | import ee
import geetools # noqa: F401
class TestGetMany:
def test_getMany(self):
d = ee.Dictionary({"foo": 1, "bar": 2}).geetools.getMany(["foo"])
assert d.getInfo() == | [1] | assert | collection | tests/test_Dictionary.py | test_getMany | TestGetMany | 32 | null |
gee-community/geetools | from __future__ import annotations
import io
import sys
import ee
import numpy as np
import pytest
from ee.ee_exception import EEException
from jsonschema import validate
from matplotlib import pyplot as plt
def reduce(
collection: ee.ImageCollection, geometry: ee.Geometry | None = None, reducer: str = "first"
)... | 719 | assert | numeric_literal | tests/test_ImageCollection.py | test_group_interval_with_interval | TestGroupInterval | 296 | null |
gee-community/geetools | from __future__ import annotations
import io
import sys
import ee
import numpy as np
import pytest
from ee.ee_exception import EEException
from jsonschema import validate
from matplotlib import pyplot as plt
def reduce(
collection: ee.ImageCollection, geometry: ee.Geometry | None = None, reducer: str = "first"
)... | firstImg.propertyNames().getInfo() | assert | func_call | tests/test_ImageCollection.py | test_reduce_interval_image_with_system_id | TestReduceInterval | 374 | null |
gee-community/geetools | import ee
import pytest
class TestSplit:
def split_with_end_outside(self, daterange_instance):
list = daterange_instance.geetools.split(2, "month")
first = ee.DateRange(list.get(0)).start()
last = ee.DateRange(list.get(-1)).end()
assert list.size().getInfo() == | 1 | assert | numeric_literal | tests/test_DateRange.py | split_with_end_outside | TestSplit | 21 | null |
gee-community/geetools | from geetools import utils
class TestFormatAssetID:
def test_valid_description(self):
"""Test a valid description."""
description = "This is a valid description 123.,:;_-"
result = utils.format_asset_id(description)
assert result == | "This_is_a_valid_description_123_____-" | assert | string_literal | tests/test_batch/test_utils.py | test_valid_description | TestFormatAssetID | 39 | null |
gee-community/geetools | import io
import ee
import geopandas as gpd
import pytest
from matplotlib import pyplot as plt
import geetools # noqa: F401
class TestAddId:
def test_add_id(self, fc_instance):
fc = fc_instance.geetools.addId()
assert fc.first().get("id").getInfo() == | 1 | assert | numeric_literal | tests/test_FeatureCollection.py | test_add_id | TestAddId | 55 | null |
gee-community/geetools | import geetools # noqa: F401
class TestIsClose:
def test_is_not_close(self, number_instance):
is_close = number_instance.geetools.isClose(1234.5)
assert is_close.getInfo() == | 0 | assert | numeric_literal | tests/test_Number.py | test_is_not_close | TestIsClose | 34 | null |
gee-community/geetools | import ee
class TestFull:
def test_full_with_integers(self):
full_array = ee.Array.geetools.full(3, 3, 1)
assert full_array.getInfo() == | [[1, 1, 1], [1, 1, 1], [1, 1, 1]] | assert | collection | tests/test_Array.py | test_full_with_integers | TestFull | 10 | null |
gee-community/geetools | import ee
import geetools # noqa: F401
class TestJoin:
def test_join_with_separator(self, mix_list):
formatted = mix_list.geetools.join(separator="; ")
assert formatted.getInfo() == | "a; 1; Image" | assert | string_literal | tests/test_List.py | test_join_with_separator | TestJoin | 116 | null |
gee-community/geetools | import ee
import pytest
from ee.cli.utils import wait_for_task
import geetools # noqa F401
class TestImageCollection:
@pytest.mark.skip(reason="The export task timeout when to many tests are run at the same time")
def test_toAsset(self, gee_test_folder):
task_list = ee.batch.Export.geetools.imagecol... | 2 | assert | numeric_literal | tests/test_Export.py | test_toAsset | TestImageCollection | 26 | null |
gee-community/geetools | from __future__ import annotations
import io
import sys
import ee
import numpy as np
import pytest
from ee.ee_exception import EEException
from jsonschema import validate
from matplotlib import pyplot as plt
def reduce(
collection: ee.ImageCollection, geometry: ee.Geometry | None = None, reducer: str = "first"
)... | 2449 | assert | numeric_literal | tests/test_ImageCollection.py | test_contains_all | TestContainsBandNames | 234 | null |
gee-community/geetools | import io
import zipfile
from io import BytesIO
from math import isclose
from pathlib import Path
from tempfile import TemporaryDirectory
from urllib.request import urlretrieve
import ee
import numpy as np
import pytest
from jsonschema import validate
from matplotlib import pyplot as plt
import geetools # noqa: F401... | ["1", "2", "3", "4", "5"] | assert | collection | tests/test_Image.py | test_from_list_multiband | TestFromList | 703 | null |
gee-community/geetools | import io
import zipfile
from io import BytesIO
from math import isclose
from pathlib import Path
from tempfile import TemporaryDirectory
from urllib.request import urlretrieve
import ee
import numpy as np
import pytest
from jsonschema import validate
from matplotlib import pyplot as plt
import geetools # noqa: F401... | {"array": [1, 2]} | assert | collection | tests/test_Image.py | test_remove_zeros | TestRemoveZeros | 346 | null |
gee-community/geetools | import ee
import pytest
class TestFloat:
def test_init(self):
with pytest.raises( | NotImplementedError) | pytest.raises | variable | tests/test_Float.py | test_init | TestFloat | 10 | null |
gee-community/geetools | from __future__ import annotations
import io
import sys
import ee
import numpy as np
import pytest
from ee.ee_exception import EEException
from jsonschema import validate
from matplotlib import pyplot as plt
def reduce(
collection: ee.ImageCollection, geometry: ee.Geometry | None = None, reducer: str = "first"
)... | 720 | assert | numeric_literal | tests/test_ImageCollection.py | test_group_interval | TestGroupInterval | 288 | null |
gee-community/geetools | from geetools import utils
class TestFormatDescription:
def test_long_description(self):
description = "A" * 150
result = utils.format_description(description)
assert len(result) == | 100 | assert | numeric_literal | tests/test_batch/test_utils.py | test_long_description | TestFormatDescription | 24 | null |
gee-community/geetools | from datetime import datetime as dt
from zoneinfo import ZoneInfo
import ee
import pytest
import geetools # noqa: F401
class TestIsLeap:
def test_is_leap_1992(self):
leap = ee.Date("1992-01-01").geetools.isLeap()
assert leap.getInfo() == | 1 | assert | numeric_literal | tests/test_Date.py | test_is_leap_1992 | TestIsLeap | 89 | null |
gee-community/geetools | import geetools # noqa: F401
class TestTruncate:
def test_truncate_with_large_decimals(self, number_instance):
truncated_number = number_instance.geetools.truncate(5)
assert truncated_number.getInfo() == | 1234.56785 | assert | numeric_literal | tests/test_Number.py | test_truncate_with_large_decimals | TestTruncate | 22 | null |
gee-community/geetools | from datetime import datetime as dt
from zoneinfo import ZoneInfo
import ee
import pytest
import geetools # noqa: F401
class TestToDatetime:
def test_to_datetime_timezone(self, date_instance):
tz = ZoneInfo("America/Buenos_Aires")
py_dt = date_instance.geetools.to_datetime(tz)
# Buenos ... | dt(2019, 12, 31, 21, tzinfo=tz) | assert | func_call | tests/test_Date.py | test_to_datetime_timezone | TestToDatetime | 22 | null |
gee-community/geetools | from __future__ import annotations
import io
import sys
import ee
import numpy as np
import pytest
from ee.ee_exception import EEException
from jsonschema import validate
from matplotlib import pyplot as plt
def reduce(
collection: ee.ImageCollection, geometry: ee.Geometry | None = None, reducer: str = "first"
)... | 3 | assert | numeric_literal | tests/test_ImageCollection.py | test_group_interval | TestGroupInterval | 287 | null |
gee-community/geetools | import ee
class TestFormat:
def test_format_missing(self):
string = ee.String("{greeting} {missing}")
params = {"greeting": "Hello", "number": 3.1415, "date": 1577836800000}
formatted_string = string.geetools.format(params)
assert formatted_string.getInfo() == | "Hello " | assert | string_literal | tests/test_String.py | test_format_missing | TestFormat | 47 | null |
gee-community/geetools | import ee
class TestFormat:
def test_format_with_dictionary(self, format_string_instance):
params = {"greeting": "Hello", "name": "bob"}
formatted_string = format_string_instance.geetools.format(params)
assert formatted_string.getInfo() == | "Hello bob !" | assert | string_literal | tests/test_String.py | test_format_with_dictionary | TestFormat | 23 | null |
gee-community/geetools | import ee
import geetools # noqa: F401
class TestSequence:
def test_sequence_with_step(self):
seq = ee.List.geetools.sequence(1, 10, 2)
assert seq.getInfo() == | list(range(1, 11, 2)) + [10] | assert | func_call | tests/test_List.py | test_sequence_with_step | TestSequence | 72 | null |
gee-community/geetools | import ee
import pytest
class TestFloat:
def test_name(self):
assert ee.Float.__name__ == | "Float" | assert | string_literal | tests/test_Float.py | test_name | TestFloat | 14 | null |
gee-community/geetools | from geetools import utils
class TestFormatDescription:
def test_unicode_characters(self):
description = "Unicode characters like é, ä, and ñ should be changed"
result = utils.format_description(description)
assert result == | "Unicode_characters_like_e,_a,_and_n_should_be_changed" | assert | string_literal | tests/test_batch/test_utils.py | test_unicode_characters | TestFormatDescription | 29 | null |
gee-community/geetools | from geetools import utils
class TestFormatDescription:
def test_replacements(self):
"""Test replacements."""
description = "Testing / replacements ?!{}()"
result = utils.format_description(description)
assert result == | "Testing_-_replacements_..::::" | assert | string_literal | tests/test_batch/test_utils.py | test_replacements | TestFormatDescription | 19 | null |
gee-community/geetools | from datetime import datetime as dt
from zoneinfo import ZoneInfo
import ee
import pytest
import geetools # noqa: F401
class TestGetUnitSinceEpoch:
def test_unit_since_epoch(self, date_instance):
unit = date_instance.geetools.getUnitSinceEpoch("year")
assert unit.getInfo() >= | 49 | assert | numeric_literal | tests/test_Date.py | test_unit_since_epoch | TestGetUnitSinceEpoch | 36 | null |
gee-community/geetools | import io
import zipfile
from io import BytesIO
from math import isclose
from pathlib import Path
from tempfile import TemporaryDirectory
from urllib.request import urlretrieve
import ee
import numpy as np
import pytest
from jsonschema import validate
from matplotlib import pyplot as plt
import geetools # noqa: F401... | "date: 2020-01-01" | assert | string_literal | tests/test_Image.py | test_to_string | testFormat | 224 | null |
gee-community/geetools | import ee
import geetools # noqa: F401
class TestJoin:
def test_join(self, mix_list):
formatted = mix_list.geetools.join()
assert formatted.getInfo() == | "a, 1, Image" | assert | string_literal | tests/test_List.py | test_join | TestJoin | 112 | null |
gee-community/geetools | import os
import ee
import pytest
import geetools # noqa F401
EARTHENGINE_PROJECT = os.environ.get("EARTHENGINE_PROJECT")
pytestmark = pytest.mark.skip(reason="The tests are way to slow")
class TestOperations:
def test_lt(self):
asset = ee.Asset("projects/bar/foo")
assert (asset < "projects/... | True | assert | bool_literal | tests/test_Asset.py | test_lt | TestOperations | 60 | null |
gee-community/geetools | import ee
class TestDateRange:
def test_dateRange_with_daterange(self, l8_sr_raw):
filter = ee.Filter.geetools.dateRange(ee.DateRange("2018-01-01", "2019-01-01"))
filtered_col = l8_sr_raw.filter(filter)
assert filtered_col.size().getInfo() == | 165030 | assert | numeric_literal | tests/test_Filter.py | test_dateRange_with_daterange | TestDateRange | 11 | null |
gee-community/geetools | import ee
import geetools # noqa: F401
class TestSequence:
def test_sequence_with_uneven_step(self):
seq = ee.List.geetools.sequence(1, 10, 3)
assert seq.getInfo() == | list(range(1, 10, 3)) + [10] | assert | func_call | tests/test_List.py | test_sequence_with_uneven_step | TestSequence | 76 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.