def testGetParametersCustomRegions(self):

        Network.cleanup()  # removes all previous registrations
        registerAllAdvancedRegions()
        json_list = Network.getRegistrations()
        #print(json_list)
        y = json.loads(json_list)
        self.assertTrue("py.ColumnPoolerRegion" in y)

        net = Network()
        #print(net.getSpecJSON("py.ColumnPoolerRegion"))
        cp = net.addRegion(
            "py.ColumnPoolerRegion", "py.ColumnPoolerRegion", """{ 
	"activationThresholdDistal": 20,
	"cellCount": 4096,
	"connectedPermanenceDistal": 0.5,
	"connectedPermanenceProximal": 0.5,
	"initialDistalPermanence": 0.51,
	"initialProximalPermanence": 0.6,
	"minThresholdProximal": 5,
	"sampleSizeDistal": 30,
	"sampleSizeProximal": 10,
	"sdrSize": 40,
	"synPermDistalDec": 0.001,
	"synPermDistalInc": 0.1,
	"synPermProximalDec": 0.001,
	"synPermProximalInc": 0.1
}""")

        # expected results from getParameters()  (in Spec order)
        expected = """{
  "learningMode": true,
  "onlineLearning": false,
  "cellCount": 4096,
  "inputWidth": 16384,
  "numOtherCorticalColumns": 0,
  "sdrSize": 40,
  "maxSdrSize": 0,
  "minSdrSize": 0,
  "synPermProximalInc": 0.100000,
  "synPermProximalDec": 0.001000,
  "initialProximalPermanence": 0.600000,
  "sampleSizeProximal": 10,
  "minThresholdProximal": 5,
  "connectedPermanenceProximal": 0.500000,
  "predictedInhibitionThreshold": 20.000000,
  "synPermDistalInc": 0.100000,
  "synPermDistalDec": 0.001000,
  "initialDistalPermanence": 0.510000,
  "sampleSizeDistal": 30,
  "activationThresholdDistal": 20,
  "connectedPermanenceDistal": 0.500000,
  "inertiaFactor": 1.000000,
  "seed": 42,
  "defaultOutputType": "active"
}"""

        json_list = cp.getParameters()
        #print(json_list)
        self.assertEqual(json_list, expected)
    def testGetParametersGridCell(self):
        # a test of arrays in parameters
        Network.cleanup()  # removes all previous registrations
        registerAllAdvancedRegions()
        json_list = Network.getRegistrations()
        #print(json_list)
        y = json.loads(json_list)
        self.assertTrue("py.GridCellLocationRegion" in y)

        # only provide one orentation to shorten the test.  Full test in location_region_test.py
        net = Network()
        #print(net.getSpecJSON("py.GridCellLocationRegion"))
        cp = net.addRegion(
            "grid", "py.GridCellLocationRegion", """{ 
  "moduleCount": 1,
  "cellsPerAxis": 10,
  "scale": [1],
  "orientation": [0.5],
  "anchorInputSize": 1,
  "activeFiringRate": 10 
}""")

        # expected results from getParameters()  (in Spec order)
        expected = """{
  "moduleCount": 1,
  "cellsPerAxis": 10,
  "scale": [1],
  "orientation": [0.5],
  "anchorInputSize": 1,
  "activeFiringRate": 10.000000,
  "bumpSigma": 0.181720,
  "activationThreshold": 10,
  "initialPermanence": 0.210000,
  "connectedPermanence": 0.500000,
  "learningThreshold": 10,
  "sampleSize": 20,
  "permanenceIncrement": 0.100000,
  "permanenceDecrement": 0.000000,
  "maxSynapsesPerSegment": -1,
  "bumpOverlapMethod": "probabilistic",
  "learningMode": false,
  "dualPhase": true,
  "dimensions": 2,
  "seed": 42
}"""

        json_list = cp.getParameters()
        #print(json_list)
        self.assertEqual(json_list, expected)