def test_capitalize():
    """ test an actual string """
    capital_mod.capitalize("sample_text_file.txt", "sample_text_file_cap.txt")
    contents = open("sample_text_file_cap.txt", 'U').read()
    expected = """This Is A Really Simple Text File.
It Is Here So That I Can Test The Capitalize Script.

And That's Only There To Try Out Distutils.

So There."""
    assert contents.strip() == expected 
예제 #2
0
def test_capitalize():
    """ test an actual string """
    capital_mod.capitalize("sample_text_file.txt", "sample_text_file_cap.txt")
    contents = open("sample_text_file_cap.txt", 'U').read()
    expected = """This Is A Really Simple Text File.
It Is Here So That I Can Test The Capitalize Script.

And That's Only There To Try Out Distutils.

So There."""
    assert contents.strip() == expected
예제 #3
0
def test_capitalize(test_file_path):
    """ test an actual file """
    p = test_file_path

    new_file_path = (p.parent / (p.stem + "_cap")).with_suffix(p.suffix)

    capital_mod.capitalize(p, new_file_path)

    contents = open(new_file_path).read()
    expected = """This is a Really Simple Text File.
It is Here So That I Can Test the Capitalize Script.

And That's Only There to Try Out Packaging.

So There."""
    assert contents.strip() == expected
예제 #4
0
def main():
    """
    startup function for running a capitalize as a script
    """
    try:
        infilename = sys.argv[1]
    except IndexError:
        print("you need to pass in a file name to process")
        print(help)
        sys.exit()
    try:
        outfilename = sys.argv[2]
    except IndexError:
        root, ext = os.path.splitext(infilename)
        outfilename = root + "_cap" + ext

    # do the real work:
    print("Capitalizing: %s and storing it in %s"%(infilename, outfilename))

    capital_mod.capitalize(infilename, outfilename)

    print("I'm done")
예제 #5
0
#!/usr/bin/env python

"""
A really simple script just to demonstrate disutils
"""

import sys, os
import capital_mod


if __name__ == "__main__":
    infilename = sys.argv[1]
    root, ext = os.path.splitext(infilename)
    outfilename = root + "_cap" + ext
    
    # do the real work:
    print "Capitalizing: %s and storing it in %s"%(infilename, outfilename)
    capital_mod.capitalize(infilename, outfilename)
    
    print "I'm done"
    
예제 #6
0
#!/usr/bin/env python

"""
A really simple script just to demonstrate disutils
"""

import sys, os
import capital_mod


if __name__ == "__main__":
    try:
        infilename = sys.argv[1]
    except IndexError:
        print("you need to pass in a file to process")

    root, ext = os.path.splitext(infilename)
    outfilename = root + "_cap" + ext
    
    # do the real work:
    print("Capitalizing: %s and storing it in %s"%(infilename, outfilename))
    capital_mod.capitalize(infilename, outfilename)
    
    print("I'm done")