예제 #1
0
    def test_quote_attrib(self):
        """Tests that the stix.bindings.quote_attrib method works properly
        on unicode inputs.

        Note:
            The quote_attrib method (more specifically, saxutils.quoteattr())
            adds quotation marks around the input data, so we need to strip
            the leading and trailing chars to test effectively
        """
        s = bindings.quote_attrib(UNICODE_STR)
        s = s[1:-1]
        self.assertEqual(s, UNICODE_STR)
예제 #2
0
    def test_quote_attrib(self):
        """Tests that the stix.bindings.quote_attrib method works properly
        on unicode inputs.

        Note:
            The quote_attrib method (more specifically, saxutils.quoteattr())
            adds quotation marks around the input data, so we need to strip
            the leading and trailing chars to test effectively
        """
        s = bindings.quote_attrib(UNICODE_STR)
        s = s[1:-1]
        self.assertEqual(s, UNICODE_STR)
예제 #3
0
 def test_quote_attrib_encoded(self):
     encoding = bindings.ExternalEncoding
     encoded = UNICODE_STR.encode(encoding)
     quoted = bindings.quote_attrib(encoded)[1:-1]
     self.assertEqual(UNICODE_STR, quoted)
예제 #4
0
 def test_quote_attrib_bool(self):
     b = True
     s = bindings.quote_attrib(b)
     self.assertEqual('"True"', s)
예제 #5
0
 def test_quote_attrib_int(self):
     i = 65536
     s = bindings.quote_attrib(i)
     self.assertEqual('"65536"', s)
예제 #6
0
 def test_quote_attrib_empty(self):
     i = ''
     s = bindings.quote_attrib(i)
     self.assertEqual('""', s)
예제 #7
0
 def test_quote_attrib_none(self):
     i = None
     s = bindings.quote_attrib(i)
     self.assertEqual('""', s)
예제 #8
0
 def test_quote_attrib_zero(self):
     i = 0
     s = bindings.quote_attrib(i)
     self.assertEqual('"0"', s)
예제 #9
0
 def test_quote_attrib_encoded(self):
     encoding = bindings.ExternalEncoding
     encoded = UNICODE_STR.encode(encoding)
     quoted = bindings.quote_attrib(encoded)[1:-1]
     self.assertEqual(UNICODE_STR, quoted)
예제 #10
0
 def test_quote_attrib_bool(self):
     b = True
     s = bindings.quote_attrib(b)
     self.assertEqual(u'"True"', s)
예제 #11
0
 def test_quote_attrib_int(self):
     i = 65536
     s = bindings.quote_attrib(i)
     self.assertEqual(u'"65536"', s)
예제 #12
0
 def test_quote_attrib_empty(self):
     i = ''
     s = bindings.quote_attrib(i)
     self.assertEqual(u'""', s)
예제 #13
0
 def test_quote_attrib_none(self):
     i = None
     s = bindings.quote_attrib(i)
     self.assertEqual(u'""', s)
예제 #14
0
 def test_quote_attrib_zero(self):
     i = 0
     s = bindings.quote_attrib(i)
     self.assertEqual(u'"0"', s)