コード例 #1
0
ファイル: test_base.py プロジェクト: rimvaliulin/pass
 def test_make_statements_list(self):
     first = [
         (['.last', '_menu'], True, True),
         ('pass', False, True),
         (['.last', '_menu', '-item'], True, False),
         (('float', 'left'), False, True),
         (['.last', '_menu', '-item', '_selected'], True, False),
         (('color', 'green'), False, True),
         (('background', 'black'), False, False),
         (['.last', '_menu', '-item', '_selected', '_modified'], True, False),
         (('margin', '0'), False, True),
         (['.last', '_menu', '-item', '_selected', '_modified', ':hover'], True, False),
         (['.last', '_menu', '-item', '_selected', '_modified', ':active'], True, True),
         ('pass', False, True),
         (['.last', '_menu', '-item', '_last'], True, False),
         ('pass', False, True),
         (['.last', '_menu'], True, False),
         ('pass', False, True),
     ]
     second = [
         ([['.last', '_menu']], []),
         ([['.last', '_menu', '-item']], [('float', 'left')]),
         ([['.last', '_menu', '-item', '_selected']], [('color', 'green'), ('background', 'black')]),
         ([['.last', '_menu', '-item', '_selected', '_modified']], [('margin', '0')]),
         ([['.last', '_menu', '-item', '_selected', '_modified', ':hover'],
           ['.last', '_menu', '-item', '_selected', '_modified', ':active']], []),
         ([['.last', '_menu', '-item', '_last']], []),
         ([['.last', '_menu']], []),
     ]
     first = list(make_statements_list(first))
     self.assertEqual(first, second)
コード例 #2
0
ファイル: test_base.py プロジェクト: rimvaliulin/pass
 def test_make_statements_list1(self):
     first = '''
     .header
     .footer
       a
         .left
         .right
           pass
         .banner
           div
             pass
       :hover
       :active
         div
           pass
     @import print
       .header
       .footer
         div
           pass
     '''
     second = [
         ([['.header', 'a', '.left'],
           ['.footer', 'a', '.left'],
           ['.header', 'a', '.right'],
           ['.footer', 'a', '.right']],
             []),
         ([['.header', 'a', '.banner', 'div'],
           ['.footer', 'a', '.banner', 'div']],
             []),
         ([['.header', ':hover', 'div'],
           ['.footer', ':hover', 'div'],
           ['.header', ':active', 'div'],
           ['.footer', ':active', 'div']],
             []),
         ([['@import print', '.header', 'div'],
           ['@import print', '.footer', 'div']],
             []),
     ]
     first = tokenize_selectors_and_properties(_in(first), self.indent)
     first = combine_selectors(_out(first, 2))
     first = list(make_statements_list(first))
     self.assertEqual(first, second)