示例#1
0
    def test_cursor_valid_2_items(self):
        cursor = is_cursor("url(some.url), url(some.url2)")
        self.assertEqual(str(cursor), 'url("some.url"), url("some.url2")')

        cursor = is_cursor("url(some.url), auto")
        self.assertEqual(str(cursor), 'url("some.url"), auto')

        cursor = is_cursor(["url(some.url)", "url(some.url2)"])
        self.assertEqual(str(cursor), 'url("some.url"), url("some.url2")')

        cursor = is_cursor(["url(some.url)", "auto"])
        self.assertEqual(str(cursor), 'url("some.url"), auto')
示例#2
0
    def test_cursor_invalid_2_items(self):
        with self.assertRaises(ValidationError):
            is_cursor("foobar, blah")

        with self.assertRaises(ValidationError):
            is_cursor("auto, url( something )")

        with self.assertRaises(ValidationError):
            is_cursor(["foobar", 'blah'])

        with self.assertRaises(ValidationError):
            is_cursor(["auto", "url(something)"])

        with self.assertRaises(ValidationError):
            is_cursor(["url(something)", "auto", "url(something)"])
示例#3
0
    def test_cursor_valid_1_item(self):
        cursor = is_cursor("url(some.url)")
        self.assertEqual(str(cursor), 'url("some.url")')

        cursor = is_cursor(" url(some.url) ")
        self.assertEqual(str(cursor), 'url("some.url")')

        cursor = is_cursor("url('some.url')")
        self.assertEqual(str(cursor), 'url("some.url")')

        cursor = is_cursor("url( 'some.url' )")
        self.assertEqual(str(cursor), 'url("some.url")')

        cursor = is_cursor('url("some.url")')
        self.assertEqual(str(cursor), 'url("some.url")')

        cursor = is_cursor('url( "some.url" )')
        self.assertEqual(str(cursor), 'url("some.url")')
示例#4
0
    def test_cursor_invalid_1_item(self):
        with self.assertRaises(ValidationError):
            is_cursor("foobar")

        with self.assertRaises(ValidationError):
            is_cursor(["foobar"])