web/test/jstest_python.jst
author Julien Jehannet <julien.jehannet@logilab.fr>
Thu, 22 Apr 2010 17:04:51 +0200
changeset 5373 24a873060692
parent 451 1261226552ec
permissions -rw-r--r--
[selector] allow inplace operator in selector computation Intended to facilitate overriding of existing selectors chain in view declaration. It make the code shorter and clearer when you've to import long module pathnames

// run tests with the following command line :
// $ crosscheck jstest_python.jst

crosscheck.addTest({

    setup: function() {
        crosscheck.load("testutils.js");
        crosscheck.load("../data/jquery.js");
        crosscheck.load("../data/cubicweb.compat.js");
        crosscheck.load("../data/cubicweb.python.js");
    },

    test_basic_number_parsing: function () {
	var d = strptime('2008/08/08', '%Y/%m/%d');
	assertArrayEquals(datetuple(d), [2008, 8, 8, 0, 0])
	d = strptime('2008/8/8', '%Y/%m/%d');
	assertArrayEquals(datetuple(d), [2008, 8, 8, 0, 0])
	d = strptime('8/8/8', '%Y/%m/%d');
	assertArrayEquals(datetuple(d), [8, 8, 8, 0, 0])
	d = strptime('0/8/8', '%Y/%m/%d');
	assertArrayEquals(datetuple(d), [0, 8, 8, 0, 0])
	d = strptime('-10/8/8', '%Y/%m/%d');
	assertArrayEquals(datetuple(d), [-10, 8, 8, 0, 0])
	d = strptime('-35000', '%Y');
	assertArrayEquals(datetuple(d), [-35000, 1, 1, 0, 0])
    },

    test_custom_format_parsing: function () {
	var d = strptime('2008-08-08', '%Y-%m-%d');
	assertArrayEquals(datetuple(d), [2008, 8, 8, 0, 0])
 	d = strptime('2008 - !  08: 08', '%Y - !  %m: %d');
 	assertArrayEquals(datetuple(d), [2008, 8, 8, 0, 0])
 	d = strptime('2008-08-08 12:14', '%Y-%m-%d %H:%M');
 	assertArrayEquals(datetuple(d), [2008, 8, 8, 12, 14])
 	d = strptime('2008-08-08 1:14', '%Y-%m-%d %H:%M');
 	assertArrayEquals(datetuple(d), [2008, 8, 8, 1, 14])
 	d = strptime('2008-08-08 01:14', '%Y-%m-%d %H:%M');
 	assertArrayEquals(datetuple(d), [2008, 8, 8, 1, 14])
   }
//,
//
//  test_gregorian_parsing: function() {
//     var d = parseGregorianDateTime("May 28 0100 09:00:00 GMT");
//     assertArrayEquals(datetuple(d), [100, 5, 28, 10, 0]);
//     d = parseGregorianDateTime("May 28 0099 09:00:00 GMT");
//     assertArrayEquals(datetuple(d), [99, 5, 28, 10, 0]);
//   }

})