コード例 #1
0
ファイル: test_functions.py プロジェクト: OYZQ/odoo_qingjia
    def test_dict_from_tcltuple(self):
        fakettuple = ('-a', '{1 2 3}', '-something', 'foo')

        self.assertEqual(ttk._dict_from_tcltuple(fakettuple, False), {
            '-a': '{1 2 3}',
            '-something': 'foo'
        })

        self.assertEqual(ttk._dict_from_tcltuple(fakettuple), {
            'a': '{1 2 3}',
            'something': 'foo'
        })

        # passing a tuple with a single item should return an empty dict,
        # since it tries to break the tuple by pairs.
        self.assertFalse(ttk._dict_from_tcltuple(('single', )))

        sspec = MockStateSpec('a', 'b')
        self.assertEqual(ttk._dict_from_tcltuple(('-a', (sspec, 'val'))),
                         {'a': [('a', 'b', 'val')]})

        self.assertEqual(
            ttk._dict_from_tcltuple((MockTclObj('-padding'),
                                     [MockTclObj('1'), 2,
                                      MockTclObj('3m')])),
            {'padding': [1, 2, '3m']})
コード例 #2
0
 def test_dict_from_tcltuple(self):
     fakettuple = ('-a', '{1 2 3}', '-something', 'foo')
     self.assertEqual(ttk._dict_from_tcltuple(fakettuple, False), {'-a': '{1 2 3}',
      '-something': 'foo'})
     self.assertEqual(ttk._dict_from_tcltuple(fakettuple), {'a': '{1 2 3}',
      'something': 'foo'})
     self.assertFalse(ttk._dict_from_tcltuple(('single',)))
     sspec = MockStateSpec('a', 'b')
     self.assertEqual(ttk._dict_from_tcltuple(('-a', (sspec, 'val'))), {'a': [('a', 'b', 'val')]})
     self.assertEqual(ttk._dict_from_tcltuple((MockTclObj('-padding'), [MockTclObj('1'), 2, MockTclObj('3m')])), {'padding': [1, 2, '3m']})
コード例 #3
0
 def test_dict_from_tcltuple(self):
     fakettuple = ('-a', '{1 2 3}', '-something', 'foo')
     self.assertEqual(ttk._dict_from_tcltuple(fakettuple, False), {'-a': '{1 2 3}',
      '-something': 'foo'})
     self.assertEqual(ttk._dict_from_tcltuple(fakettuple), {'a': '{1 2 3}',
      'something': 'foo'})
     self.assertFalse(ttk._dict_from_tcltuple(('single',)))
     sspec = MockStateSpec('a', 'b')
     self.assertEqual(ttk._dict_from_tcltuple(('-a', (sspec, 'val'))), {'a': [('a', 'b', 'val')]})
     self.assertEqual(ttk._dict_from_tcltuple((MockTclObj('-padding'), [MockTclObj('1'), 2, MockTclObj('3m')])), {'padding': [1, 2, '3m']})
コード例 #4
0
ファイル: test_functions.py プロジェクト: grakidov/buildtools
    def test_dict_from_tcltuple(self):
        fakettuple = ("-a", "{1 2 3}", "-something", "foo")

        self.assertEqual(ttk._dict_from_tcltuple(fakettuple, False), {"-a": "{1 2 3}", "-something": "foo"})

        self.assertEqual(ttk._dict_from_tcltuple(fakettuple), {"a": "{1 2 3}", "something": "foo"})

        # passing a tuple with a single item should return an empty dict,
        # since it tries to break the tuple by pairs.
        self.assertFalse(ttk._dict_from_tcltuple(("single",)))

        sspec = MockStateSpec("a", "b")
        self.assertEqual(ttk._dict_from_tcltuple(("-a", (sspec, "val"))), {"a": [("a", "b", "val")]})

        self.assertEqual(
            ttk._dict_from_tcltuple((MockTclObj("-padding"), [MockTclObj("1"), 2, MockTclObj("3m")])),
            {"padding": [1, 2, "3m"]},
        )
コード例 #5
0
ファイル: test_functions.py プロジェクト: van7hu/fanca
    def test_dict_from_tcltuple(self):
        fakettuple = ('-a', '{1 2 3}', '-something', 'foo')

        self.assertEqual(ttk._dict_from_tcltuple(fakettuple, False),
            {'-a': '{1 2 3}', '-something': 'foo'})

        self.assertEqual(ttk._dict_from_tcltuple(fakettuple),
            {'a': '{1 2 3}', 'something': 'foo'})

        # passing a tuple with a single item should return an empty dict,
        # since it tries to break the tuple by pairs.
        self.assertFalse(ttk._dict_from_tcltuple(('single', )))

        sspec = MockStateSpec('a', 'b')
        self.assertEqual(ttk._dict_from_tcltuple(('-a', (sspec, 'val'))),
            {'a': [('a', 'b', 'val')]})

        self.assertEqual(ttk._dict_from_tcltuple((MockTclObj('-padding'),
            [MockTclObj('1'), 2, MockTclObj('3m')])),
            {'padding': [1, 2, '3m']})