[GRASS-SVN] r65797 - grass/trunk/lib/python/script/testsuite
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jul 29 07:21:21 PDT 2015
Author: zarch
Date: 2015-07-29 07:21:21 -0700 (Wed, 29 Jul 2015)
New Revision: 65797
Added:
grass/trunk/lib/python/script/testsuite/test_core_make_val.py
Log:
script:testsuite add test to _make_val function
Added: grass/trunk/lib/python/script/testsuite/test_core_make_val.py
===================================================================
--- grass/trunk/lib/python/script/testsuite/test_core_make_val.py (rev 0)
+++ grass/trunk/lib/python/script/testsuite/test_core_make_val.py 2015-07-29 14:21:21 UTC (rev 65797)
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
+
+from grass.script.core import _make_val
+
+
+class TestCoreMakeVal(TestCase):
+ """Tests function `_make_val` that convert value to bytes."""
+
+ def test_bytes(self):
+ self.assertEqual(b'text', _make_val(b'text'))
+
+ def test_unicode(self):
+ self.assertEqual(b'text', _make_val(u'text'))
+
+ def test_int(self):
+ self.assertEqual(b'123', _make_val(123))
+
+ def test_float(self):
+ self.assertEqual(b'1.23', _make_val(1.23))
+
+ def test_iterable(self):
+ test = b'text', u'text', 123, 1.23
+ solution = b'text,text,123,1.23'
+ self.assertEqual(solution, _make_val(test))
+
+
+if __name__ == '__main__':
+ test()
Property changes on: grass/trunk/lib/python/script/testsuite/test_core_make_val.py
___________________________________________________________________
Added: svn:mime-type
+ text/x-python
Added: svn:eol-style
+ native
More information about the grass-commit
mailing list