mirror of
https://github.com/LazoCoder/Pokemon-Terminal
synced 2024-11-27 14:21:06 +00:00
Make main() a separate function so we can test it
This commit is contained in:
parent
b32ed4b9e2
commit
16c49a97c1
1 changed files with 6 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
|||
# This module is for testing the different components of this project.
|
||||
|
||||
from database import Database
|
||||
from sys import argv
|
||||
import sys
|
||||
|
||||
|
||||
def print_items(items):
|
||||
|
@ -70,7 +70,7 @@ def test_database_double_arg(arg):
|
|||
print("No such public method '" + arg + "' with two parameters exists in the Database class.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def main(argv):
|
||||
if len(argv) == 1:
|
||||
print("No command line parameters provided.")
|
||||
elif len(argv) == 2:
|
||||
|
@ -79,3 +79,7 @@ if __name__ == "__main__":
|
|||
test_database_double_arg(argv)
|
||||
else:
|
||||
print("This module only takes one command line parameter.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv)
|
||||
|
|
Loading…
Reference in a new issue