t301.py 522 B

123456789101112131415161718192021222324252627282930
  1. # Test the comparison of sets
  2. print '# actual super & subsets'
  3. sup = set([1,2,3,4,100])
  4. print sup
  5. sub = set([2,3,4])
  6. print sub
  7. print '# forwards'
  8. print sup.isdisjoint(sub)
  9. print sup > sub
  10. print sup.issuperset(sub)
  11. print sup >= sub
  12. print sup == sub
  13. print sup != sub
  14. print sup.issubset(sub)
  15. print sup <= sub
  16. print sup < sub
  17. print '# backwards'
  18. print sub.isdisjoint(sup)
  19. print sub > sup
  20. print sub.issuperset(sup)
  21. print sub >= sup
  22. print sub == sup
  23. print sub != sup
  24. print sub.issubset(sup)
  25. print sub <= sup
  26. print sub < sup