Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
tdoehmen committed Aug 10, 2022
2 parents e205055 + c513bbe commit 6bad332
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 16 deletions.
19 changes: 9 additions & 10 deletions python/hsfs/constructor/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,20 @@
from hsfs.core import query_constructor_api, storage_connector_api
from hsfs.constructor import join
from hsfs.constructor.filter import Filter, Logic
from unittest.mock import MagicMock


class Query:
def __init__(
self,
left_feature_group: MagicMock,
left_features: MagicMock,
feature_store_name: Optional[str]=None,
feature_store_id: Optional[int]=None,
left_feature_group_start_time: None=None,
left_feature_group_end_time: None=None,
joins: None=None,
filter: None=None,
) -> None:
left_feature_group,
left_features,
feature_store_name=None,
feature_store_id=None,
left_feature_group_start_time=None,
left_feature_group_end_time=None,
joins=None,
filter=None,
):
self._feature_store_name = feature_store_name
self._feature_store_id = feature_store_id
self._left_feature_group = left_feature_group
Expand Down
18 changes: 17 additions & 1 deletion python/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#
# Copyright 2022 Hopsworks AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import pytest
from tests.fixtures.backend_fixtures import response_get_feature_group
from tests.fixtures.backend_fixtures import backend_fixtures

pytest_plugins = [
"tests.fixtures.backend_fixtures",
Expand Down
22 changes: 19 additions & 3 deletions python/tests/fixtures/backend_fixtures.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
#
# Copyright 2022 Hopsworks AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import pytest
import json

with open('python/tests/fixtures/backend_fixtures.json', 'r') as json_file:
backend_fixtures = json.load(json_file)
backend_fixtures_json = json.load(json_file)

@pytest.fixture
def response_get_feature_group():
return backend_fixtures["get_feature_group"]["response"]
def backend_fixtures():
return backend_fixtures_json
4 changes: 2 additions & 2 deletions python/tests/test_feature_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

class TestFeatureGroup:

def test_from_response_json(self, response_get_feature_group):
fg = FeatureGroup.from_response_json(response_get_feature_group)[0]
def test_from_response_json(self, backend_fixtures):
fg = FeatureGroup.from_response_json(backend_fixtures["get_feature_group"]["response"])[0]

assert fg.id == 15
assert len(fg._features) == 2
Expand Down

0 comments on commit 6bad332

Please sign in to comment.