mathmaker  0.6(alpha)
mamk_misc/doc/mathmaker4doxygen/maintenance/autotest/obj_test/table_complete_numeric_test.py
00001 # -*- coding: utf-8 -*-
00002 
00003 # Mathmaker creates automatically maths exercises sheets
00004 # with their answers
00005 # Copyright 2006-2014 Nicolas Hainaux <nico_h@users.sourceforge.net>
00006 
00007 # This file is part of Mathmaker.
00008 
00009 # Mathmaker is free software; you can redistribute it and/or modify
00010 # it under the terms of the GNU General Public License as published by
00011 # the Free Software Foundation; either version 3 of the License, or
00012 # any later version.
00013 
00014 # Mathmaker is distributed in the hope that it will be useful,
00015 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 # GNU General Public License for more details.
00018 
00019 # You should have received a copy of the GNU General Public License
00020 # along with Mathmaker; if not, write to the Free Software
00021 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00022 
00023 import os
00024 import sys
00025 import math
00026 #import locale
00027 
00028 #from lib.common import default
00029 
00030 from core import *
00031 from core.base_calculus import *
00032 
00033 from maintenance.autotest import common
00034 
00035 #try:
00036 #   locale.setlocale(locale.LC_ALL, default.LANGUAGE + '.' + default.ENCODING)
00037 #except:
00038 #    locale.setlocale(locale.LC_ALL, '')
00039 
00040 check = common.check
00041 
00042 def action():
00043     if common.verbose:
00044         os.write(common.output,
00045                  bytes("--- TABLES : numeric & complete\n", 'utf-8'))
00046 
00047     # Don't forget to uncomment the convenient lines above if a test
00048     # requires to use the locale module.
00049 
00050     t1 = Table_CN([[Item((2)), Item((5)),  Item((6)),  Item((7)) ],
00051                    [Item((4)), Item((10)), Item((12)), Item((14))]
00052                   ]
00053                  )
00054 
00055     check(str(t1.is_proportional()),
00056          ["True"])
00057 
00058     check(str(t1.coefficient()),
00059          ["2"])
00060 
00061     t2 = Table_CN([[Item((2)), Item((5)),  Item((6)),  Item((7)) ],
00062                    [Item((4)), Item((10)), Item((12)), Item((13))]
00063                   ]
00064                  )
00065 
00066     check(str(t2.is_proportional()),
00067          ["False"])
00068 
00069     check(str(t2.coefficient()),
00070          ["None"])
00071 
00072