Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test calling the scheduler #4

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

Flix6x
Copy link
Contributor

@Flix6x Flix6x commented Jan 20, 2025

Closes #3.

  • Start namespace for S2 AssetTypes
  • Add fixtures for setting Asset attributes that the scheduler will require
  • Add first test for schema validation
  • Add first test for calling scheduler directly
  • Add first test for calling scheduler via API

Todo @VladIftime:

  • Where it says # todo: port test cases from Java test please add at least one example of the profile you found in the Java code, then let me know and we can discuss how to adjust the schemas to make that test pass.
  • Where it says # todo: add serialized state please assign the serialized state to a variable in a separate Python file and then import the variable here. Otherwise, the conftest.py will become too large. Then we can start adjusting the S2FlexModelSchema to use the s2-python library.

Copy link
Contributor Author

@Flix6x Flix6x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a pointer. Thanks for creating the example JSON.

Comment on lines 24 to 25
# Define the test object
test_device_state = S2FrbcDeviceState(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's define two variables here:

  • example_serialized_device_state, which loads the JSON you added. This variable is the one that the conftest should import, because we want to store a serialized state on the asset attributes
  • example_deserialized_device_state, which is the object you already defined here. This variable could be used in a new schema test, as an expected outcome of loading (i.e. deserializing) example_serialized_device_state using the S2FlexModelSchema`.

Copy link
Contributor Author

@Flix6x Flix6x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going in the right direction.

flex_model={}, # S2Scheduler fetches this from asset attributes
flex_context={},
)
assert scheduler.deserialize_config() == example_deserialized_device_state
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert scheduler.deserialize_config().flex_model == example_deserialized_device_state?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make test in flexmeasure-s2 that replicates the tno scheduler tests
2 participants