Commit 09f5ba7247222c8e7306243312b50dc5da8156d2

Authored by selurvedu
1 parent bd22902a

Append extension to filename for temporary files

Closes #45.
... ... @@ -12,7 +12,8 @@ fake_en = Factory.create()
12 12
13 13 def create_fake_doc():
14 14 content = fake.text()
15   - tf = NamedTemporaryFile(delete=False)
  15 + suffix = fake.random_element(('.txt', '.doc', '.docx', '.pdf'))
  16 + tf = NamedTemporaryFile(delete=False, suffix=suffix)
16 17 tf.write(content)
17 18 tf.close()
18 19 return tf.name
... ...
Please register or login to post a comment