Skip to content
This repository was archived by the owner on Nov 13, 2025. It is now read-only.

Conversation

@agslaj-ALock
Copy link
Contributor

  • Wrote the communications worker unit test
  • Fixed a typo inside communications

Copy link
Member

@maxlou05 maxlou05 left a comment

Choose a reason for hiding this comment

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

Reviewed

object_in_world_from_position_local(local_position_1),
object_in_world_from_position_local(local_position_2),
]
number_of_messages = 2
Copy link
Member

Choose a reason for hiding this comment

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

Just use len(objects_in_world)

Comment on lines 174 to 191
# Conversion
result, worker_id, actual_1 = message_encoding_decoding.decode_bytes_to_position_global(
generated_objects[0]
)
assert result
assert worker_id is not None
assert actual_1 is not None

result, worker_id, actual_2 = message_encoding_decoding.decode_bytes_to_position_global(
generated_objects[1]
)
assert result
assert worker_id is not None
assert actual_2 is not None

# Test
assert_global_positions(global_position_1, actual_1)
assert_global_positions(global_position_2, actual_2)
Copy link
Member

Choose a reason for hiding this comment

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

You can put this in a loop


actual = object_in_world_from_position_local(local_position)
objects_in_world = [actual]
number_of_messages = 1
Copy link
Member

Choose a reason for hiding this comment

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

len()

position = object_in_world_from_position_local(local_position)

objects_in_world = [position, position, position]
number_of_messages = 3
Copy link
Member

Choose a reason for hiding this comment

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

len()

Copy link
Member

@maxlou05 maxlou05 left a comment

Choose a reason for hiding this comment

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

Reviewed

Comment on lines 60 to 61
objects_in_world = objects_in_world or []

Copy link
Member

Choose a reason for hiding this comment

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

My bad, I realized that we will never receive None as an input, the worker takes care of that and makes sure the type coming in is the same as the type listed above. You can probably remove that test case

metadata
)
assert result
assert worker_id is not None
Copy link
Member

Choose a reason for hiding this comment

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

Can you assert this is worker_enum.COMMUNICATIONS_WORKER? (Also from common's data_encoding module)

generated_objects[i]
)
assert result
assert worker_id is not None
Copy link
Member

Choose a reason for hiding this comment

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

worker_enum.COMMUNICATIONS_WORKER

assert actual_number_of_messages == 0
assert len(generated_objects) == 0

def test_none(self, communications_maker: communications.Communications) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

My bad, no need for this lol

Comment on lines 315 to 316
assert metadata is not None
assert generated_objects is not None
Copy link
Member

Choose a reason for hiding this comment

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

check types

metadata
)
assert result
assert worker_id is not None
Copy link
Member

Choose a reason for hiding this comment

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

real value

)
assert result
assert worker_id is not None
assert actual_number_of_messages is not None
Copy link
Member

Choose a reason for hiding this comment

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

remove

)
assert result
assert worker_id is not None
assert actual is not None
Copy link
Member

Choose a reason for hiding this comment

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

remove

generated_object
)
assert result
assert worker_id is not None
Copy link
Member

Choose a reason for hiding this comment

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

real value

Copy link
Member

@maxlou05 maxlou05 left a comment

Choose a reason for hiding this comment

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

Approved!

@agslaj-ALock agslaj-ALock merged commit c21a30c into main Feb 10, 2025
1 check passed
@agslaj-ALock agslaj-ALock deleted the Communication-worker-unit-tests branch February 10, 2025 02:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants