  
  class TestUtopianTree(object):
  
      def test_utopian_tree(self):
          assert_equal(calc_utopian_tree_height(0), 1)
          assert_equal(calc_utopian_tree_height(1), 2)
          assert_equal(calc_utopian_tree_height(4), 7)
          print('Success: test_utopian_tree')
  
  
  def main():
      test = TestUtopianTree()
 
</s> remove     "        assert_equal(calc_utopian_tree_height(0), 1)\n",
    "        assert_equal(calc_utopian_tree_height(1), 2)\n",
    "        assert_equal(calc_utopian_tree_height(4), 7)\n",
 </s> add     "        solution = Solution()\n",
    "        assert_equal(solution.calc_utopian_tree_height(0), 1)\n",
    "        assert_equal(solution.calc_utopian_tree_height(1), 2)\n",
    "        assert_equal(solution.calc_utopian_tree_height(4), 7)\n", </s> remove     "        assert_equal(calc_utopian_tree_height(0), 1)\n",
    "        assert_equal(calc_utopian_tree_height(1), 2)\n",
    "        assert_equal(calc_utopian_tree_height(4), 7)\n",
 </s> add     "        solution = Solution()\n",
    "        assert_equal(solution.calc_utopian_tree_height(0), 1)\n",
    "        assert_equal(solution.calc_utopian_tree_height(1), 2)\n",
    "        assert_equal(solution.calc_utopian_tree_height(4), 7)\n", </s> remove     "def calc_utopian_tree_height(cycles):\n",
    "    height = 1\n",
    "    if cycles == 0:\n",
    "        return height\n",
    "    for i in range(1, cycles+1):\n",
    "        if i % 2 == 1:\n",
    "            height *= 2\n",
    "        else:\n",
    "            height += 1\n",
    "    return height"
 </s> add     "class Solution(object):\n",
    "\n",
    "    def calc_utopian_tree_height(self, cycles):\n",
    "        height = 1\n",
    "        if cycles == 0:\n",
    "            return height\n",
    "        for i in range(1, cycles+1):\n",
    "            if i % 2 == 1:\n",
    "                height *= 2\n",
    "            else:\n",
    "                height += 1\n",
    "        return height" </s> remove     "def calc_utopian_tree_height(cycles):\n",
    "    # TODO: Implement me\n",
    "    pass"
 </s> add     "class Solution(object):\n",
    "\n",
    "    def calc_utopian_tree_height(self, cycles):\n",
    "        # TODO: Implement me\n",
    "        pass" </s> remove    "pygments_lexer": "ipython2",
   "version": "2.7.10"
 </s> add    "pygments_lexer": "ipython3",
   "version": "3.5.0"
        solution = Solution()
        assert_equal(solution.calc_utopian_tree_height(0), 1)
        assert_equal(solution.calc_utopian_tree_height(1), 2)
        assert_equal(solution.calc_utopian_tree_height(4), 7)
  
  class TestUtopianTree(object):
  
      def test_utopian_tree(self):
        solution = Solution()
        assert_equal(solution.calc_utopian_tree_height(0), 1)
        assert_equal(solution.calc_utopian_tree_height(1), 2)
        assert_equal(solution.calc_utopian_tree_height(4), 7)
        solution = Solution()
        assert_equal(solution.calc_utopian_tree_height(0), 1)
        assert_equal(solution.calc_utopian_tree_height(1), 2)
        assert_equal(solution.calc_utopian_tree_height(4), 7)
        solution = Solution()
        assert_equal(solution.calc_utopian_tree_height(0), 1)
        assert_equal(solution.calc_utopian_tree_height(1), 2)
        assert_equal(solution.calc_utopian_tree_height(4), 7)
          print('Success: test_utopian_tree')
  
  
  def main():
      test = TestUtopianTree()
keep keep keep keep replace replace replace keep keep keep keep keep
 Move utopian tree challenge solution to a class (#144) 
online_judges/utopian_tree/test_utopian_tree.py