def test_getUnitDataArch(self): # create a unloaded river unit to just check the readHeadData() method. b = bridgeunit.BridgeUnitArch() # Put the test data into the method b.readUnitData(self.arch_unitdata, 0) """Check it's returning the correctly formatted data""" test_output = [ 'BRIDGE Main Road bridge - Trimmed to BT', 'ARCH', '1.056_BU 1.056_BD 1.056_US 1.056_DS ', 'MANNING', ' 1.000 40.000 0.000 0.000 0 ORIFICE 0.100 0.100 1.000', ' 15', ' 0.000 37.651 0.025 ', ' 0.065 36.161 0.025 ', ' 0.137 36.122 0.025 ', ' 0.391 34.171 0.025 ', ' 0.650 34.125 0.040 L', ' 0.710 33.743 0.040 ', ' 1.618 33.543 0.040 ', ' 2.694 33.598 0.040 ', ' 3.729 33.513 0.040 ', ' 4.408 33.519 0.040 ', ' 5.306 33.553 0.040 ', ' 6.441 33.758 0.040 ', ' 6.459 34.954 0.040 ', ' 6.478 36.174 0.025 R', ' 6.557 36.229 0.025 ', ' 1', ' 0.710 6.441 34.470 36.000' ] output = b.getData() self.assertListEqual(test_output, output)
def test_readRowDataArch(self): """Check that BridgeUnitArch row data is ok""" # create a unloaded river unit to just check the readHeadData() method. b = bridgeunit.BridgeUnitArch() # Put the test data into the method b.readUnitData(self.arch_unitdata, 0) # Lists for each of the data objects that are created when reading the file chainage = [ 0.000, 0.065, 0.137, 0.391, 0.650, 0.710, 1.618, 2.694, 3.729, 4.408, 5.306, 6.441, 6.459, 6.478, 6.557 ] elevation = [ 37.651, 36.161, 36.122, 34.171, 34.125, 33.743, 33.543, 33.598, 33.513, 33.519, 33.553, 33.758, 34.954, 36.174, 36.229 ] roughness = [ 0.025, 0.025, 0.025, 0.025, 0.040, 0.040, 0.040, 0.040, 0.040, 0.040, 0.040, 0.040, 0.040, 0.025, 0.025 ] 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 = [0.71] open_end = [6.441] spring = [34.47] soffit = [36.0] 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)
def test_readHeadDataArch(self): """Check that the HeadDataItem's get read in ok.""" # create a unloaded river unit to just check the readHeadData() method. b = bridgeunit.BridgeUnitArch() # Put the test data into the method b._readHeadData(self.arch_unitdata, 0) self.assertEqual(b._name, '1.056_BU') self.assertEqual(b._name_ds, '1.056_BD') self.assertEqual(b.head_data['comment'].value, 'Main Road bridge - Trimmed to BT') self.assertEqual(b.head_data['remote_us'].value, '1.056_US') self.assertEqual(b.head_data['remote_ds'].value, '1.056_DS') self.assertEqual(b.head_data['roughness_type'].value, 'MANNING') self.assertEqual(b.head_data['calibration_coef'].value, 1.000) self.assertEqual(b.head_data['skew_angle'].value, 40.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['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.0)