diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-07-27 18:02:06 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:40 -0300 |
commit | fe4dd9d63f8113d978e4380a9333bbe3ade5d9ec (patch) | |
tree | 25c683d158f173cfb646777a41fd94e34ceccf90 /tests | |
parent | d68d90a1445b7ba7f5d86ae133516bb48107b3c3 (diff) |
Created unit test for QScriptValue __repr__ function.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/QtScript/qscriptvalue_test.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/QtScript/qscriptvalue_test.py b/tests/QtScript/qscriptvalue_test.py index 3a03e96e2..d029bf9fc 100644 --- a/tests/QtScript/qscriptvalue_test.py +++ b/tests/QtScript/qscriptvalue_test.py @@ -1,12 +1,12 @@ import unittest -from PySide.QtCore import * -from PySide.QtScript import * +import PySide +from PySide.QtScript import QScriptEngine, QScriptValue -class TestQScriptValue (unittest.TestCase): +from helper import UsesQApplication - def testOperator(self): - app = QCoreApplication([]) +class TestQScriptValue (UsesQApplication): + def testOperator(self): engine = QScriptEngine() value = engine.evaluate('x = {"a": 1, "b":2}') self.assertEqual(value['a'], 1) @@ -15,6 +15,10 @@ class TestQScriptValue (unittest.TestCase): self.assertEqual(value[2], 'z') self.assertRaises(IndexError, value.__getitem__, 23) + def testRepr(self): + value = QScriptValue("somePerson = { firstName: 'John', lastName: 'Doe' }") + value2 = eval(repr(value)) + self.assertEqual(value.toString(), value2.toString()) if __name__ == '__main__': unittest.main() |