def test_count_by_type_single_link(self, universe_DWA): ''' This test tests the simplest water bridge to see if count_by_type() works. ''' wb = WaterBridgeAnalysis(universe_DWA, 'protein and (resid 1)', 'protein and (resid 4)') wb.run(verbose=False) assert_equal(wb.count_by_type(), [(1, 4, 'ALA', 1, 'H', 'ALA', 4, 'O', 1.)])
def test_nodata(self, universe_DA): '''Test if the funtions can run when there is no data. This is achieved by not runing the run() first.''' wb = WaterBridgeAnalysis(universe_DA, 'protein and (resid 1)', 'protein and (resid 4)', order=0) wb.generate_table() assert_equal(wb.timesteps_by_type(), None) assert_equal(wb.count_by_time(), None) assert_equal(wb.count_by_type(), None)
def test_count_by_type_multiple_link(self, universe_AWA_AWWA): ''' This test tests if count_by_type() can give the correct result for more than 1 links. ''' wb = WaterBridgeAnalysis(universe_AWA_AWWA, 'protein and (resid 1 or resid 5)', 'protein and (resid 4 or resid 8)', order=2) wb.run(verbose=False) assert_equal(sorted(wb.count_by_type()), [[0, 4, 'ALA', 1, 'O', 'ALA', 4, 'O', 1.0], [5, 11, 'ALA', 5, 'O', 'ALA', 8, 'O', 1.0]])