示例#1
0
    def test_gender_inheritance(self):
        main(["-p", "test_data/spivak"])

        expected_preview = """Alice.txt:
----------
You know a man called John Smith. He has a sister called Mary Jones.  Yesterday you met a person called Alex Kim, who invited you to have lunch with em.

"""

        self.assertEqual(self.last_out(), expected_preview)
示例#2
0
    def test_subdir(self):
        main(["-p", "test_data/subdir"])
        expected_preview = """One/Alice.txt:
--------------
You know a man called John Smith. He has a sister called Mary Jones.

Two/Bob.txt:
------------
You know a man called John Smith. He has a sister called Mary Jones.

"""
        self.assertEqual(self.last_out(), expected_preview)
示例#3
0
    def test_glob(self):
        main(["-p", "test_data/glob"])
        expected_preview = """Alice.txt:
----------
You know a man called John Smith. He has a sister called Mary Jones.

Bob.txt:
--------
You know a man called John Smith. He has a sister called Mary Jones.

"""
        self.assertEqual(self.last_out(), expected_preview)
示例#4
0
    def test_preview(self):
        main(["-p", "example"])
        expected_preview = """Alice.txt:
----------
You know a man called John Smith. He has a sister called Mary Jones.

Alice.odt:
----------
You know a man called John Smith. He has a sister called Mary Jones.

Alice.docx:
-----------
You know a man called John Smith. He has a sister called Mary Jones.

"""
        self.assertEqual(self.last_out(), expected_preview)
示例#5
0
 def test_missing_subs(self):
     main(["-m", "test_data/missingsubs"])
     self.assertEqual(self.last_out(),
                      "jones_name,smith_name,smith_person,smith_they\n")
示例#6
0
 def test_subs(self):
     main(["-s", "example"])
     self.assertEqual(
         self.last_out(),
         "jones_child:daughter,jones_grandparent:grandmother,jones_name:Mary,jones_parent:mother,jones_parentsibling:aunt,jones_person:woman,jones_sibling:sister,jones_siblingchild:niece,jones_spouse:wife,jones_their:her,jones_theirs:hers,jones_them:her,jones_themselves:herself,jones_they:she,jones_youngperson:girl,smith_child:son,smith_grandparent:grandfather,smith_name:John,smith_parent:father,smith_parentsibling:uncle,smith_person:man,smith_sibling:brother,smith_siblingchild:nephew,smith_spouse:husband,smith_their:his,smith_theirs:his,smith_them:him,smith_themselves:himself,smith_they:he,smith_youngperson:boy\n"
     )
示例#7
0
 def test_bad_output_dir(self):
     with self.assertRaises(GenderiserError):
         main(["-o", "example", "example"])
示例#8
0
 def test_nothing_missing(self):
     main(["-m", "example"])
     self.assertEqual(self.last_out(), "\n")