@@ -30,6 +30,30 @@ def test_extract_simple_single_quotes(self):
30
30
messages = list (extract_django (buf , default_keys , [], {}))
31
31
self .assertEqual ([(1 , None , u'Bunny' , [])], messages )
32
32
33
+ def test_extract_simple_with_context_single_quotes (self ):
34
+ buf = BytesIO (b"{% trans 'Bunny' context 'carrot' %}" )
35
+ messages = list (extract_django (buf , default_keys , [], {}))
36
+ self .assertEqual ([(1 , 'pgettext' ,
37
+ [u'carrot' , u'Bunny' ], [])], messages )
38
+
39
+ def test_extract_simple_with_context_double_quotes (self ):
40
+ buf = BytesIO (b"{% trans 'Bunny' context \" carrot\" %}" )
41
+ messages = list (extract_django (buf , default_keys , [], {}))
42
+ self .assertEqual ([(1 , 'pgettext' ,
43
+ [u'carrot' , u'Bunny' ], [])], messages )
44
+
45
+ def test_extract_simple_with_context_with_single_quotes (self ):
46
+ buf = BytesIO (b"{% trans 'Bunny' context \" 'carrot'\" %}" )
47
+ messages = list (extract_django (buf , default_keys , [], {}))
48
+ self .assertEqual ([(1 , 'pgettext' ,
49
+ [u'\' carrot\' ' , u'Bunny' ], [])], messages )
50
+
51
+ def test_extract_simple_with_context_with_double_quotes (self ):
52
+ buf = BytesIO (b"{% trans 'Bunny' context '\" carrot\" ' %}" )
53
+ messages = list (extract_django (buf , default_keys , [], {}))
54
+ self .assertEqual ([(1 , 'pgettext' ,
55
+ [u'"carrot"' , u'Bunny' ], [])], messages )
56
+
33
57
def test_extract_var (self ):
34
58
buf = BytesIO (b'{% blocktrans %}{{ anton }}{% endblocktrans %}' )
35
59
messages = list (extract_django (buf , default_keys , [], {}))
0 commit comments