-
Notifications
You must be signed in to change notification settings - Fork 14
[Bug]: agentsets_by_type won't work with duplicate types #124
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
Comments
@adamamer20 Look into this and let me know if this sounds good or if I should give more context |
Do you mean adding a specific |
In my understanding, However, when retrieving agent sets from Does this interpretation align with how |
If they are different agent "types" (eg. If the bug happens anyway with different classes, we should handle it. |
They will be different like say a I hope this makes sense |
Mmm, so there is a problem with classes having the same base class? But we have a test for that and it seems to work. |
see the reason the tests work cause they dont take care of all the edge cases @pytest.fixture
def fix_AgentsDF( fix1_AgentSetPandas: ExampleAgentSetPandas, fix2_AgentSetPolars: ExampleAgentSetPolars,) -> AgentsDF:
model = ModelDF()
agents = AgentsDF(model)
agents.add([fix1_AgentSetPandas, fix2_AgentSetPolars])
return agents
def test_agentsets_by_type(self, fix_AgentsDF: AgentsDF):
agents = fix_AgentsDF
result = agents.agentsets_by_type
assert isinstance(result, dict)
assert isinstance(result[ExampleAgentSetPandas], AgentsDF)
assert isinstance(result[ExampleAgentSetPolars], AgentsDF)
assert result[ExampleAgentSetPandas]._agentsets == [agents._agentsets[0]]
assert result[ExampleAgentSetPolars]._agentsets == [agents._agentsets[1]] lets change the fix def fix_AgentsDF(
fix1_AgentSetPolars: ExampleAgentSetPolars,
fix2_AgentSetPolars: ExampleAgentSetPolars,
) -> AgentsDF:
model = ModelDF()
agents = AgentsDF(model)
agents.add([fix1_AgentSetPolars, fix2_AgentSetPolars])
return agents
def test_agentsets_by_type(self, fix_AgentsDF: AgentsDF):
agents = fix_AgentsDF
result = agents.agentsets_by_type
assert isinstance(result, dict)
assert isinstance(result[ExampleAgentSetPolars], AgentsDF)
assert result[ExampleAgentSetPolars]._agentsets == [agents._agentsets[1]] # this will pass
assert result[ExampleAgentSetPolars]._agentsets == [agents._agentsets[0]] # this will raise an error obviously coz 2 agent sets are of the type ExampleAgentSetPolars so even though we try to get I really hope this explains what I am trying to say TT |
Alright perfect, so the initial idea was to allow a single |
📝 Description
the function agentsets_by_type(self) in the file agents.py
won't work with duplicate types
it will only store the latest agents_df
🔄 Steps to Reproduce
No response
🎯 Expected Behavior
Ideas :
i think the first method is better
🚨 Actual Behavior
No response
🖥️ Python Version
No response
Operating System
No response
Relevant Packages
No response
📊 Relevant Log Output
No response
➕ Additional Context
No response
The text was updated successfully, but these errors were encountered: