@@ -1783,6 +1783,10 @@ def test_poll_ex(self):
1783
1783
class TestShellCompletersAndParsers (TestCase ):
1784
1784
def setUp (self ):
1785
1785
super ().setUp ()
1786
+ self .q1 = Question .objects .create (
1787
+ question_text = "Is Putin a war criminal?" ,
1788
+ pub_date = timezone .now (),
1789
+ )
1786
1790
for field , values in {
1787
1791
"char_field" : ["jon" , "john" , "jack" , "jason" ],
1788
1792
"text_field" : [
@@ -1819,6 +1823,19 @@ def tearDown(self) -> None:
1819
1823
ShellCompleteTester .objects .all ().delete ()
1820
1824
return super ().tearDown ()
1821
1825
1826
+ def test_model_object_parser_idempotency (self ):
1827
+ from django_typer .parsers import ModelObjectParser
1828
+ from django_typer .tests .polls .models import Question
1829
+
1830
+ parser = ModelObjectParser (Question )
1831
+ self .assertEqual (parser .convert (self .q1 , None , None ), self .q1 )
1832
+
1833
+ def test_app_label_parser_idempotency (self ):
1834
+ from django_typer .parsers import parse_app_label
1835
+
1836
+ poll_app = apps .get_app_config ("django_typer_tests_polls" )
1837
+ self .assertEqual (parse_app_label (poll_app ), poll_app )
1838
+
1822
1839
def test_app_label_parser_completers (self ):
1823
1840
from django .apps import apps
1824
1841
0 commit comments