Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pyAmak - noyau
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMAC
AMAK
Python
PyAMAK
pyAmak - noyau
Commits
09f9cc89
Commit
09f9cc89
authored
4 years ago
by
shinedday
Browse files
Options
Downloads
Patches
Plain Diff
Fix Test : Agent -> test_run
parent
d7a336e1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pyAmakCore/classes/agent.py
+6
-0
6 additions, 0 deletions
pyAmakCore/classes/agent.py
pyAmakCore/tests/test_agent/test_run.py
+26
-2
26 additions, 2 deletions
pyAmakCore/tests/test_agent/test_run.py
with
32 additions
and
2 deletions
pyAmakCore/classes/agent.py
+
6
−
0
View file @
09f9cc89
...
...
@@ -72,6 +72,12 @@ class Agent:
"""
return
self
.
__environment
def
get_phase
(
self
)
->
Phase
:
"""
return current phase of agent
"""
return
self
.
__phase
def
add_neighbour
(
self
,
agent
:
'
Agent
'
)
->
None
:
"""
add agent into neighbours of current agent
...
...
This diff is collapsed.
Click to expand it.
pyAmakCore/tests/test_agent/test_run.py
+
26
−
2
View file @
09f9cc89
...
...
@@ -6,6 +6,7 @@ from unittest import TestCase, main
from
pyAmakCore.classes.agent
import
Agent
from
pyAmakCore.classes.amas
import
Amas
from
pyAmakCore.classes.environment
import
Environment
from
pyAmakCore.enumeration.agent_phase
import
Phase
from
pyAmakCore.enumeration.executionPolicy
import
ExecutionPolicy
...
...
@@ -14,15 +15,38 @@ class TestAgentRun(TestCase):
Test class for Agent run
"""
def
test_run
(
self
):
def
test_run_one_phase
(
self
):
"""
test that run() work and return correct phase with 1 phase policy
"""
Agent
.
reset_agent
()
environment
=
Environment
()
amas
=
Amas
(
environment
)
amas
.
set_execution_policy
(
ExecutionPolicy
.
ONE_PHASE
)
agent
=
Agent
(
amas
)
self
.
assertEqual
(
agent
.
get_phase
(),
Phase
.
INITIALIZING
)
agent
.
run
()
self
.
assertEqual
()
self
.
assertEqual
(
agent
.
get_phase
(),
Phase
.
DECISION_AND_ACTION_DONE
)
agent
.
run
()
self
.
assertEqual
(
agent
.
get_phase
(),
Phase
.
DECISION_AND_ACTION_DONE
)
def
test_run_two_phase
(
self
):
"""
test that run() work and return correct phase with 2 phase policy
"""
Agent
.
reset_agent
()
environment
=
Environment
()
amas
=
Amas
(
environment
)
amas
.
set_execution_policy
(
ExecutionPolicy
.
TWO_PHASES
)
agent
=
Agent
(
amas
)
self
.
assertEqual
(
agent
.
get_phase
(),
Phase
.
INITIALIZING
)
agent
.
run
()
self
.
assertEqual
(
agent
.
get_phase
(),
Phase
.
PERCEPTION_DONE
)
agent
.
run
()
self
.
assertEqual
(
agent
.
get_phase
(),
Phase
.
DECISION_AND_ACTION_DONE
)
if
__name__
==
'
__main__
'
:
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment