def test_getUnitDataUsbpr(self): """Check it's returning the correctly formatted data""" # create a unloaded river unit to just check the readHeadData() method. b = bridgeunit.BridgeUnitUsbpr() # Put the test data into the method b.readUnitData(self.usbpr_unitdata, 0) test_output = [ 'BRIDGE Bridge over the weir at bend in river based on section 1.042', 'USBPR1978', '1.042_BU 1.042_BD 1.042_US 1.042_DS ', 'MANNING', ' 1.000 0.000 0.000 0.000 0 ORIFICE 0.100 0.100 1.000', ' 3', ' 0FLAT ', ' ALIGNED', ' 11', ' 11.562 33.961 0.040 L', ' 11.587 33.667 0.040 ', ' 11.692 32.418 0.040 ', ' 12.030 32.417 0.040 ', ' 12.579 32.426 0.040 ', ' 13.475 32.419 0.040 ', ' 14.452 32.422 0.040 ', ' 15.127 32.425 0.040 ', ' 15.231 33.667 0.040 ', ' 15.256 33.969 0.040 ', ' 15.267 34.096 0.040 R', ' 1', ' 11.587 15.231 33.680 33.680', ' 1', ' 0.000 0.000 0.000 1.000 1.000 1.000' ] output = b.getData() self.assertListEqual(test_output, output)
def test_readHeadDataUsbpr(self): """Check that the HeadDataItem's get read in ok.""" # create a unloaded river unit to just check the readHeadData() method. b = bridgeunit.BridgeUnitUsbpr() # Put the test data into the method b._readHeadData(self.usbpr_unitdata, 0) self.assertEqual(b._name, '1.042_BU') self.assertEqual(b._name_ds, '1.042_BD') self.assertEqual(b.head_data['remote_us'].value, '1.042_US') self.assertEqual(b.head_data['remote_ds'].value, '1.042_DS') self.assertEqual(b.head_data['calibration_coef'].value, 1.000) self.assertEqual(b.head_data['skew_angle'].value, 0.000) self.assertEqual(b.head_data['width'].value, 0.000) self.assertEqual(b.head_data['dual_distance'].value, 0.000) self.assertEqual(b.head_data['num_of_orifices'].value, 0) self.assertEqual(b.head_data['orifice_flag'].value, 'ORIFICE') self.assertEqual(b.head_data['op_lower'].value, 0.1) self.assertEqual(b.head_data['op_upper'].value, 0.1) self.assertEqual(b.head_data['op_cd'].value, 1) self.assertEqual(b.head_data['abutment_type'].value, '3') self.assertEqual(b.head_data['num_of_piers'].value, 0) self.assertEqual(b.head_data['pier_shape'].value, 'FLAT') self.assertEqual(b.head_data['pier_shape_2'].value, '') self.assertEqual(b.head_data['pier_calibration_coef'].value, '') self.assertEqual(b.head_data['abutment_align'].value, 'ALIGNED')
def test_readUnitDataUsbpr(self): """ """ # create a unloaded river unit to just check the readHeadData() method. b = bridgeunit.BridgeUnitUsbpr() # Put the test data into the method b.readUnitData(self.usbpr_unitdata, 0) # Lists for each of the data objects that are created when reading the file chainage = [ 11.562, 11.587, 11.692, 12.03, 12.579, 13.475, 14.452, 15.127, 15.231, 15.256, 15.267 ] elevation = [ 33.961, 33.667, 32.418, 32.417, 32.426, 32.419, 32.422, 32.425, 33.667, 33.969, 34.096 ] roughness = [ 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04 ] marker = ['L', '', '', '', '', '', '', '', '', '', 'R'] self.assertListEqual(b.row_data['main'].dataObjectAsList(rdt.CHAINAGE), chainage) self.assertListEqual( b.row_data['main'].dataObjectAsList(rdt.ELEVATION), elevation) self.assertListEqual( b.row_data['main'].dataObjectAsList(rdt.ROUGHNESS), roughness) self.assertListEqual( b.row_data['main'].dataObjectAsList(rdt.EMBANKMENT), marker) open_start = [11.587] open_end = [15.231] spring = [33.68] soffit = [33.68] self.assertListEqual( b.row_data['opening'].dataObjectAsList(rdt.OPEN_START), open_start) self.assertListEqual( b.row_data['opening'].dataObjectAsList(rdt.OPEN_END), open_end) self.assertListEqual( b.row_data['opening'].dataObjectAsList(rdt.SPRINGING_LEVEL), spring) self.assertListEqual( b.row_data['opening'].dataObjectAsList(rdt.SOFFIT_LEVEL), soffit)