climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1571058 - /incubator/climate/trunk/ocw-ui/backend/tests/test_processing.py
Date Sun, 23 Feb 2014 18:40:57 GMT
Author: joyce
Date: Sun Feb 23 18:40:57 2014
New Revision: 1571058

URL: http://svn.apache.org/r1571058
Log:
CLIMATE-347 - Add balance_grid_shape tests

Modified:
    incubator/climate/trunk/ocw-ui/backend/tests/test_processing.py

Modified: incubator/climate/trunk/ocw-ui/backend/tests/test_processing.py
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/ocw-ui/backend/tests/test_processing.py?rev=1571058&r1=1571057&r2=1571058&view=diff
==============================================================================
--- incubator/climate/trunk/ocw-ui/backend/tests/test_processing.py (original)
+++ incubator/climate/trunk/ocw-ui/backend/tests/test_processing.py Sun Feb 23 18:40:57 2014
@@ -144,6 +144,20 @@ class TestCalculateGridShape(unittest.Te
         shape = bp._calculate_grid_shape(ref_dataset, max_cols=3)
         self.assertEquals(shape, (3, 3))
 
+class TestBalanceGridShape(unittest.TestCase):
+    def test_balance_grid_shape(self):
+        # Test column imbalance
+        self.assertEquals(bp._balance_grid_shape(7, 2, 6), (3, 3))
+        self.assertEquals(bp._balance_grid_shape(7, 2, 4), (3, 3))
+        self.assertEquals(bp._balance_grid_shape(10, 2, 6), (3, 4))
+        self.assertEquals(bp._balance_grid_shape(20, 3, 7), (4, 5))
+
+        # Test row imbalance
+        self.assertEquals(bp._balance_grid_shape(7, 6, 2), (3, 3))
+        self.assertEquals(bp._balance_grid_shape(7, 4, 2), (3, 3))
+        self.assertEquals(bp._balance_grid_shape(10, 6, 2), (3, 4))
+        self.assertEquals(bp._balance_grid_shape(20, 7, 3), (4, 5))
+
 class TestFilePathCreation(unittest.TestCase):
     def setUp(self):
         self.full_evaluation = Evaluation(



Mime
View raw message