Example #1
0
 def test__non_string_returns_None(self):
     result = parse_labeled_constraint_map(dict())
     self.assertThat(result, Is(None))
Example #2
0
 def test__empty_string_returns_empty_map(self):
     result = parse_labeled_constraint_map("")
     self.assertThat(result, Equals({}))
Example #3
0
 def test__label_with_no_constraints_raises(self):
     with ExpectedException(ConstraintTestException):
         parse_labeled_constraint_map(
             "a:", exception_type=ConstraintTestException)
Example #4
0
 def test__single_value_map(self):
     result = parse_labeled_constraint_map("a:b=c")
     self.assertThat(result, Equals({"a": {"b": ["c"]}}))
Example #5
0
 def test__invalid_label_raises(self):
     with ExpectedException(ConstraintTestException):
         parse_labeled_constraint_map(
             "*:b=c", exception_type=ConstraintTestException)
Example #6
0
 def test__duplicate_label_raises(self):
     with ExpectedException(ConstraintTestException):
         parse_labeled_constraint_map(
             "a:b=c;a:d=e", exception_type=ConstraintTestException)
Example #7
0
 def test__missing_key_value_pair_raises(self):
     with ExpectedException(ConstraintTestException):
         parse_labeled_constraint_map(
             "a:bc", exception_type=ConstraintTestException)
Example #8
0
 def test_multiple_value_map_with_duplicate_keys_appends_to_list(self):
     result = parse_labeled_constraint_map("a:a=abc,a=def,a=ghi")
     self.assertThat(result, Equals({"a": {"a": ["abc", "def", "ghi"]}}))
Example #9
0
 def test_multiple_value_map(self):
     result = parse_labeled_constraint_map("a:b=c,d=e")
     self.assertThat(result, Equals({"a": {"b": ["c"], "d": ["e"]}}))