Exemple #1
0
    def test_quotes_valid_1_pair(self):
        quotes = Quotes([('<', '>')])

        self.assertEqual(quotes.opening(level=0), '<')
        self.assertEqual(quotes.closing(level=0), '>')
        self.assertEqual(len(quotes), 1)
        self.assertEqual(str(quotes), "'<' '>'")
        self.assertEqual(repr(quotes), "Quotes([('<', '>')])")
Exemple #2
0
    def test_quotes_invalid_1_pair_level(self):
        quotes = Quotes([('<', '>')])

        with self.assertRaises(IndexError):
            quotes.opening(level=1)

        with self.assertRaises(IndexError):
            quotes.closing(level=1)
Exemple #3
0
    def test_quotes_valid_2_pairs(self):
        quotes = Quotes([('<', '>'), ('{', '}')])

        self.assertEqual(quotes.opening(level=0), '<')
        self.assertEqual(quotes.closing(level=0), '>')
        self.assertEqual(quotes.opening(level=1), '{')
        self.assertEqual(quotes.closing(level=1), '}')
        self.assertEqual(len(quotes), 2)
        self.assertEqual(str(quotes), "'<' '>' '{' '}'")
        self.assertEqual(repr(quotes), "Quotes([('<', '>'), ('{', '}')])")
Exemple #4
0
    def test_quotes_valid_list_1_pair(self):
        node = TestNode(style=CSS())
        node.layout.dirty = None

        node.style.quotes = [('<', '>')]
        self.assertEqual(node.style.quotes, Quotes([('<', '>')]))
Exemple #5
0
    def test_quotes_valid_sequence_4_items(self):
        node = TestNode(style=CSS())
        node.layout.dirty = None

        node.style.quotes = '<', '>', '{', '}'
        self.assertEqual(node.style.quotes, Quotes([('<', '>'), ('{', '}')]))
Exemple #6
0
    def test_quotes_valid_str_2_items(self):
        node = TestNode(style=CSS())
        node.layout.dirty = None

        node.style.quotes = "'<' '>'"
        self.assertEqual(node.style.quotes, Quotes([('<', '>')]))
 def test_quote_valid(self):
     self.assertEqual(is_quote("'<' '>' '{' '}'"),
                      Quotes([('<', '>'), ('{', '}')]))