Browse Source

Update tests to work with the new and shiny ENUM names (359:12f3d59c25de, "nice enums")

sync
heck 5 years ago
parent
commit
25c977ff57
  1. 2
      test/basic_doctest.py
  2. 38
      test/doctest_PYADPT-55.py

2
test/basic_doctest.py

@ -16,7 +16,7 @@ Bob Bourne <bob.bourne@peptest.ch>
>>> print(m2) >>> print(m2)
>>> m3, keys, rating, flags = m2.decrypt() >>> m3, keys, rating, flags = m2.decrypt()
>>> rating >>> rating
pEp.PEP_rating.PEP_rating_reliable pEp.rating.reliable
""" """
if __name__ == "__main__": if __name__ == "__main__":

38
test/doctest_PYADPT-55.py

@ -1,44 +1,44 @@
# Regression test against API breakage # Regression test against API breakage
# colors used to be represented as a simple int # colors used to be represented as a simple int
# NEW: colors are represented by PEP_color enum # NEW: colors are represented by colorvalue enum
# Test for equal resolution of colors using int (OLD) vs using PEP_color (NEW) # Test for equal resolution of colors using int (OLD) vs using colorvalue (NEW)
print("Running PYADPT-55")
""" """
>>> resolveOLDvsNEW(pEp.PEP_color.PEP_color_no_color) >>> resolveOLDvsNEW(pEp.colorvalue.no_color)
True True
>>> resolveOLDvsNEW(pEp.PEP_color.PEP_color_yellow) >>> resolveOLDvsNEW(pEp.colorvalue.yellow)
True True
>>> resolveOLDvsNEW(pEp.PEP_color.PEP_color_green) >>> resolveOLDvsNEW(pEp.colorvalue.green)
True True
>>> resolveOLDvsNEW(pEp.PEP_color.PEP_color_red) >>> resolveOLDvsNEW(pEp.colorvalue.red)
True True
""" """
import pEp import pEp
# resolves a color represented as int, the OLD way # resolves a color represented as int, the OLD way, as an int.
# returns PEP_color # returns colorvalue
def resolveColorOLD(col): def resolveColorOLD(col):
ret = pEp.PEP_color() ret = pEp.colorvalue()
c = pEp.PEP_color(col) c = pEp.colorvalue(col)
if(c == 0): if(c == 0):
ret = pEp.PEP_color.PEP_color_no_color ret = pEp.colorvalue.no_color
if(c == 1): if(c == 1):
ret = pEp.PEP_color.PEP_color_yellow ret = pEp.colorvalue.yellow
if(c == 2): if(c == 2):
ret = pEp.PEP_color.PEP_color_green ret = pEp.colorvalue.green
if(c == -1): if(c == -1):
ret = pEp.PEP_color.PEP_color_red ret = pEp.colorvalue.red
return ret return ret
# resolves a color represented as PEP_color, the NEW way # resolves a color represented as colorvalue, the NEW way
# returns PEP_color # returns colorvalue
def resolveColorNEW(col): def resolveColorNEW(col):
c = pEp.PEP_color(col) c = pEp.colorvalue(col)
return col return c
# Compare color resolution OLD vs NEW way # Compare color resolution OLD vs NEW way
# return True if results are equal # return True if results are equal

Loading…
Cancel
Save