def test_pattern_multiple_all(self):
     s = String(["foo", "bar", "baz"])
     s.condition = "Equals"
     s.apply_condition = "ALL"
     # If we change @apply_condition from the default, it should match
     # that value.
     self.assertTrue(b'apply_condition="ALL"' in s.to_xml())
Beispiel #2
0
 def test_pattern_multiple_all(self):
     s = String(["foo", "bar", "baz"])
     s.condition = "Equals"
     s.apply_condition = "ALL"
     # If we change @apply_condition from the default, it should match
     # that value.
     self.assertTrue(b'apply_condition="ALL"' in s.to_xml())
    def test_unicode_string(self):
        s = u("A Unicode \ufffd string")
        string = String(s)

        unicode_string = six.text_type(string)
        self.assertEqual(s, unicode_string)
        self.assertEqual(s.encode("utf-8"), unicode_string.encode("utf-8"))
        self.assertTrue(s.encode("utf-8") in string.to_xml())
Beispiel #4
0
    def test_unicode_string(self):
        s = u("A Unicode \ufffd string")
        string = String(s)

        unicode_string = six.text_type(string)
        self.assertEqual(s, unicode_string)
        self.assertEqual(s.encode("utf-8"), unicode_string.encode("utf-8"))
        self.assertTrue(s.encode("utf-8") in string.to_xml())
 def test_delimiter(self):
     s = String(["string1", "string2"])
     s.delimiter = "##delim##"
     self.assertTrue(b"##comma##" not in s.to_xml())
     self.assertTrue(b"string1##delim##string2" in s.to_xml())
 def test_pattern_multiple(self):
     s = String(["foo", "bar", "baz"])
     s.condition = "Equals"
     # @apply_condition should be set when there is a @condition and the
     # value is a list.
     self.assertTrue(b'apply_condition="ANY"' in s.to_xml())
 def test_pattern_single(self):
     s = String("foo")
     s.condition = "Equals"
     # @apply_condition should not be set if the value is not a list.
     self.assertFalse(b'apply_condition' in s.to_xml())
 def test_instance_multiple_all(self):
     s = String(["foo", "bar", "baz"])
     s.apply_condition = "ALL"
     # Even though we set it, this is not a pattern so @apply_condition
     # shouldn't be output.
     self.assertFalse(b'apply_condition' in s.to_xml())
 def test_instance_multiple(self):
     s = String(["foo", "bar", "baz"])
     # @apply_condition should not be set on instances.
     self.assertFalse(b'apply_condition' in s.to_xml())
 def test_instance_single(self):
     s = String("foo")
     # @apply_condition should not be set on instances.
     self.assertFalse(b'apply_condition' in s.to_xml())
Beispiel #11
0
 def test_delimiter(self):
     s = String(["string1", "string2"])
     s.delimiter = "##delim##"
     self.assertTrue(b"##comma##" not in s.to_xml())
     self.assertTrue(b"string1##delim##string2" in s.to_xml())
Beispiel #12
0
 def test_pattern_multiple(self):
     s = String(["foo", "bar", "baz"])
     s.condition = "Equals"
     # @apply_condition should be set when there is a @condition and the
     # value is a list.
     self.assertTrue(b'apply_condition="ANY"' in s.to_xml())
Beispiel #13
0
 def test_pattern_single(self):
     s = String("foo")
     s.condition = "Equals"
     # @apply_condition should not be set if the value is not a list.
     self.assertFalse(b'apply_condition' in s.to_xml())
Beispiel #14
0
 def test_instance_multiple_all(self):
     s = String(["foo", "bar", "baz"])
     s.apply_condition = "ALL"
     # Even though we set it, this is not a pattern so @apply_condition
     # shouldn't be output.
     self.assertFalse(b'apply_condition' in s.to_xml())
Beispiel #15
0
 def test_instance_multiple(self):
     s = String(["foo", "bar", "baz"])
     # @apply_condition should not be set on instances.
     self.assertFalse(b'apply_condition' in s.to_xml())
Beispiel #16
0
 def test_instance_single(self):
     s = String("foo")
     # @apply_condition should not be set on instances.
     self.assertFalse(b'apply_condition' in s.to_xml())