init_code = """
if not "Building" in USER_GLOBAL:
    raise NotImplementedError("Where is 'Building'?")

Building = USER_GLOBAL['Building']
"""

run_test = """RET['code_result'] = {}
"""

def prepare_test(test, answer, middle_code="\n", show_code=None):
    if show_code is None:
        show_code = middle_code + test
    return {"test_code": {"python-3": init_code + middle_code + run_test.format(test),
                          "python-27": init_code + middle_code + run_test.format(test)},
            "show": {"python-3": show_code,
                     "python-27": show_code},
            "answer": answer}

TESTS = {
    "1. Init": [
        prepare_test("", "", "Building((1, 1), (2, 2))"),
        prepare_test("", "", "Building((1, 1), (2, 2), 10)"),
        prepare_test("", "", "Building((0.54345, 1.12313), (2./6, 3.3 * 5), 1./2)")
    ],
    "2. Str": [
        prepare_test("str(Building((1, 1), (2, 2))",
                     "Building from [1, 1] to [2, 2]. Height 10.",),
        prepare_test("str(Building((0.2, 1), (2, 2.2), 3.5)",
                     "Building from [0.2, 1] to [2, 2.2]. Height 3.5.",),
    ]
}

@@ -675,31 +675,27 @@
 uilding(
-(
 1, 1
-)
 , 
-(
 2, 2)
-)
 %22),%0A    
@@ -729,30 +729,26 @@
 uilding(
-(
 1, 1
-)
 , 
-(
 2, 2
-)
 , 10)%22),
@@ -787,17 +787,16 @@
 uilding(
-(
 0.54345,
@@ -803,20 +803,18 @@
  1.12313
-)
 , 
-(
 2./6, 3.
@@ -818,17 +818,16 @@
  3.3 * 5
-)
 , 1./2)%22
@@ -890,23 +890,19 @@
 ing(
-(
 1, 1
-)
 , 
-(
 2, 2)
-)
 %22,%0A 
@@ -947,17 +947,24 @@
  1%5D 
-to %5B2,
+with size 2 by
  2
-%5D
 . He
@@ -1015,26 +1015,22 @@
 ing(
-(
 0.2, 1
-)
 , 
-(
 2, 2.2
-)
 , 3.
@@ -1083,19 +1083,26 @@
  1%5D 
-to %5B2,
+with size 2 by
  2.2
-%5D
 . He

update test