Skip to content

ismaelharunid/python-development-quality

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

python-development-quality

A pdq python test suite

There are a number of features yet to be implemented... (see issues)

Simple usage

>>> import pdq
>>> 
>>> test_suite = pdq.WriterTestSuite("root")
>>> 
>>> ts = pdq.WriterTestSuite("using-assert", parent=test_suite, verbosity=4)
>>> 
>>> assert ts.isequal("4", 4), ts.get_last_run()
>>> assert ts.isequal("'four'", "four"), ts.get_last_run()
>>> assert ts.isequal("{}", {}), ts.get_last_run()
>>> assert ts.isne("4", 5), ts.get_last_run()
>>> assert ts.islt("False", True), ts.get_last_run()
>>> assert ts.isge("7", 7), ts.get_last_run()
>>> assert ts.isgt("7", 5), ts.get_last_run()
>>> assert ts.isle("4", 5), ts.get_last_run()
>>> assert ts.issame("None", None), ts.get_last_run()
>>> assert ts.issame("type(1)", int), ts.get_last_run()
>>> assert ts.notsame("type(1.0)", int), ts.get_last_run()
>>> assert ts.iscontaining("(1,2,3)", 2), ts.get_last_run()
>>> assert ts.isin("2", (1,2,3)), ts.get_last_run()
>>> assert ts.notcontaining("(1,2,3)", 4), ts.get_last_run()
>>> assert ts.notin("5", (1,2,3)), ts.get_last_run()
>>> assert ts.isinstance("5", int), ts.get_last_run()
>>> assert ts.notinstance("5", float), ts.get_last_run()
>>> assert ts.issubclass("int", object), ts.get_last_run()
>>> assert ts.notsubclass("float", type), ts.get_last_run()
>>> assert ts.istruish("57"), ts.get_last_run()
>>> assert ts.nottruish("None"), ts.get_last_run()
>>> assert ts.isthrowing("1/0", ZeroDivisionError), repr(ts.get_last_run())
>>> 
>>> ts = pdq.WriterTestSuite("setup-and-run", parent=test_suite)
>>> 
>>> ts.add("isequal", "4", 4)
>>> ts.add("isequal", "'four'", "four")
>>> ts.add("isequal", "{}", {})
>>> ts.add("isne", "4", 5)
>>> ts.add("islt", "False", True)
>>> ts.add("isge", "7", 7)
>>> ts.add("isgt", "7", 5)
>>> ts.add("isle", "4", 5)
>>> ts.add("issame", "None", None)
>>> ts.add("issame", "type(1)", int)
>>> ts.add("notsame", "type(1.0)", int)
>>> ts.add("iscontaining", "(1,2,3)", 2)
>>> ts.add("isin", "2", (1,2,3))
>>> ts.add("notcontaining", "(1,2,3)", 4)
>>> ts.add("notin", "5", (1,2,3))
>>> ts.add("isinstance", "5", int)
>>> ts.add("notinstance", "5", float)
>>> ts.add("issubclass", "int", object)
>>> ts.add("notsubclass", "float", type)
>>> ts.add("istruish", "57")
>>> ts.add("nottruish", "None")
>>> ts.add("isthrowing", "1/0", ZeroDivisionError)
>>> 
>>> test_suite.run_tests()
>>> test_suite.summary()
Summary for root
  [PASS] this 0/0, total 44/44
  [FAIL] this 0/0, total 0/44
  [ERR]  this 0/0, total 0/44
  with 2 children
    Summary for using-assert
      [PASS] 22/22
      [FAIL] 0/22
      [ERR]  0/22
      no children
    Summary for setup-and-run
      [PASS] 22/22
      [FAIL] 0/22
      [ERR]  0/22
      no children

About

A pdq python test suite

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages