def test_tokens_from_declaration_with_two_strings(self): self.assertEquals(["MyAnnotation","(","Dog","=",'"Snoopy"',",","Boy","=",'"Charly Brown"',")"], annotations.tokens('MyAnnotation(Dog="Snoopy",Boy="Charly Brown")'))
def test_tokens_from_declaration_with_nested_objects_and_two_strings(self): self.assertEquals(['Credits','(','Author','=','"Philippe Bourgau"',',','Version','=','@','Version','(','Major','=','"0.9"',')',')'], annotations.tokens('Credits(Author="Philippe Bourgau",Version=@Version(Major="0.9"))'))
def test_tokens_from_declaration_with_an_object_value(self): self.assertEquals(["MyAnnotation","(","Value","=","@","MyValue","(",")",")"], annotations.tokens("MyAnnotation(Value=@MyValue())"))
def test_tokens_from_declaration_with_a_list_of_objects_value(self): self.assertEquals(["MyAnnotation","(","Value","=","{","@","MyValue","(",")",",","@","YourValue","(",")","}",")"], annotations.tokens("MyAnnotation(Value={@MyValue(),@YourValue()})"))
def test_tokens_from_declaration_with_a_string_value(self): self.assertEquals(["MyAnnotation","(","Name","=","\"Snoopy\"",")"], annotations.tokens("MyAnnotation(Name=\"Snoopy\")"))
def test_tokens_from_declaration_with_an_escaped_string_value(self): self.assertEquals(["MyAnnotation","(","Quote","=",'"\\"Only the goods die young\\""',")"], annotations.tokens('MyAnnotation(Quote="\\"Only the goods die young\\"")'))
def test_tokens_from_declaration_with_many_values(self): self.assertEquals(["MyAnnotation","(","Five","=","5",",","Six","=","6",")"], annotations.tokens("MyAnnotation(Five=5,Six=6)"))
def test_tokens_from_declaration_with_a_value(self): self.assertEquals(["MyAnnotation","(","Five","=","5",")"], annotations.tokens("MyAnnotation(Five=5)"))
def test_tokens_from_declaration_with_whitespaces(self): self.assertEquals(["YourAnnotation","(",")"], annotations.tokens("YourAnnotation ( )"))
def test_tokens_from_declaration_with_namespace(self): self.assertEquals(["home::MyAnnotation","(",")"], annotations.tokens("home::MyAnnotation()"))
def test_tokens_from_simple_declaration(self): self.assertEquals(["MyAnnotation","(",")"], annotations.tokens("MyAnnotation()"))