|
|
|
|
|
|
import pytest |
|
|
|
import socket |
|
|
|
import mock |
|
|
|
import struct |
|
|
|
|
|
|
|
def append_length(input): |
|
|
|
return struct.pack("I", len(input.encode())) + input.encode() |
|
|
|
|
|
|
|
|
|
|
|
"apiNumber":"API-2", |
|
|
|
"brainParameters": [{ |
|
|
|
"stateSize": 3, |
|
|
|
"actionSize": 2, |
|
|
|
|
|
|
|
|
|
|
dummy_reset = [ |
|
|
|
'CONFIG_REQUEST'.encode(), |
|
|
|
append_length( |
|
|
|
''' |
|
|
|
{ |
|
|
|
"brain_name": "RealFakeBrain", |
|
|
|
|
|
|
"actions": [1,2,3,4], |
|
|
|
"memories": [], |
|
|
|
"dones": [false, false] |
|
|
|
}'''.encode(), |
|
|
|
}'''), |
|
|
|
''' |
|
|
|
append_length(''' |
|
|
|
{ |
|
|
|
"brain_name": "RealFakeBrain", |
|
|
|
"agents": [1,2,3], |
|
|
|
|
|
|
"memories": [], |
|
|
|
"dones": [false, false, false] |
|
|
|
}'''.encode(), |
|
|
|
}'''), |
|
|
|
''' |
|
|
|
append_length(''' |
|
|
|
{ |
|
|
|
"brain_name": "RealFakeBrain", |
|
|
|
"agents": [1,2,3], |
|
|
|
|
|
|
"memories": [], |
|
|
|
"dones": [false, false, true] |
|
|
|
}'''.encode(), |
|
|
|
}'''), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_initialialization(): |
|
|
|
with mock.patch('subprocess.Popen') as mock_subproc_popen: |
|
|
|