Skip to content

Comments

Test calling the scheduler#4

Open
Flix6x wants to merge 8 commits intomainfrom
feat/mock-test-frbc-planner
Open

Test calling the scheduler#4
Flix6x wants to merge 8 commits intomainfrom
feat/mock-test-frbc-planner

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.

Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: Vlad Iftime <vladiftime60@gmail.com>
Signed-off-by: Vlad Iftime <vladiftime60@gmail.com>
Signed-off-by: Vlad Iftime <vladiftime60@gmail.com>
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`.

Signed-off-by: Vlad Iftime <vladiftime60@gmail.com>
Signed-off-by: Vlad Iftime <vladiftime60@gmail.com>
Signed-off-by: Vlad Iftime <vladiftime60@gmail.com>
Signed-off-by: Vlad Iftime <vladiftime60@gmail.com>
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?

@Flix6x
Copy link
Contributor Author

Flix6x commented Feb 18, 2025

What's the status on this PR?

@Flix6x
Copy link
Contributor Author

Flix6x commented Feb 18, 2025

We discussed moving one of the test devices from #5 into this PR. @VladIftime, did you mean this test device?

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