def test_checksum(): """ Inputs that are the correct format and length """ assert checksum("786936224306") is True assert checksum("085392132225") is True assert checksum("717951000841") is False # should be 2
def test_input_type(): """ Inputs that are the incorrect format and length """ with pytest.raises(TypeError): checksum(1.0) with pytest.raises(TypeError): checksum(786936224306)
def test_checksum(): """ Inputs that are the correct format and length """ assert checksum("786936224306") is True assert checksum("085392132225") is True assert checksum("012222335895") is False # same numbers, different order assert checksum("717951000841") is False assert checksum("746936224300") is True # 0 check digit
def test_checksum(): """ Inputs that are the correct format and length """ assert checksum("786936224306") is True assert checksum("085392132225") is True assert checksum("717951000841") is False assert checksum("127847390583") is False assert checksum("123456789012") is True
def test_input(): """ Inputs that are incorrect """ with pytest.raises(TypeError): checksum(1.0) checksum(786936224306) with pytest.raises(ValueError): checksum("1") checksum("1234567890") checksum("UPC")
def test_checksum(): """ Inputs that are the correct format and length """ assert checksum("786936224306") is True assert checksum("085392132225") is True assert checksum("717951000841") is False assert checksum("435804790143") is False assert checksum("823911165203") is False assert checksum("314439932290") is False assert checksum("590467329014") is False assert checksum("671298457041") is False assert checksum("474365717905") is False assert checksum("172346155116") is True
def test_checksum(): """ Inputs that are the correct format and length """ assert checksum("786936224306") is True assert checksum("085392132225") is True assert checksum("717951000841") is False assert checksum ("435804790143") is False assert checksum ("823911165203") is False assert checksum ("314439932290") is False assert checksum ("590467329014") is False assert checksum ("671298457041") is False assert checksum ("474365717905") is False assert checksum ("172346155116") is True
def test_input(): """ Inputs that are the incorrect format and length """ with pytest.raises(TypeError): checksum(1.0) # Test float checksum(786936224306) # Test Integer with pytest.raises(ValueError): checksum("1") # test length of input checksum("1234567890")
def test_input(): """ Inputs that are the incorrect format and length """ with pytest.raises(TypeError): checksum(1.0) checksum(7869639068306306306) with pytest.raises(ValueError): checksum("1") checksum("1234567890")
def test_checksum(): """ Inputs that are the correct format and length """ assert checksum("786936224306") is True assert checksum("085392132225") is True assert checksum("678112801053") is True assert checksum("070330505230") is True assert checksum("996780012679") is False assert checksum("044509310403") is False assert checksum("098123940224") is False assert checksum("717951000841") is False
def test_checksum(): """ Inputs that are the correct format and length """ assert checksum("786936224306") is True assert checksum("085392132225") is True assert checksum("717951000841") is False assert checksum("158635895321") is True # added test assert checksum("123456789012") is True # added test assert checksum("000000000000") is True # added test assert checksum("737373737373") is False # added test assert checksum("888888888888") is False # added test
def text_str_len(): """ Inputs that are the incorrect length. """ with pytest.raises(ValueError): checksum("1") with pytest.raises(ValueError): checksum("1234567890") with pytest.raises(ValueError): checksum("123456789") with pytest.raises(ValueError): checksum("12345678912345")
def test_checksum(): """ Inputs that are the correct format and length """ assert checksum("786936224306") is True assert checksum("085392132225") is True assert checksum("717951000841") is False assert checksum("892685001003") is True assert checksum("012345678905") is True assert checksum("692771017440") is True assert checksum("827624391275") is False assert checksum("012345678901") is False
def test_input_value(): with pytest.raises(ValueError): checksum("1") with pytest.raises(ValueError): checksum("1234567890") with pytest.raises(ValueError): checksum("123456789012345")
def test_checksum(): """ Inputs that are the correct format and length. """ assert checksum("786936224306") is True assert checksum("085392132225") is True assert checksum("717951000842") is True assert checksum("085392132226") is False assert checksum("085392132227") is False assert checksum("717951000841") is False assert checksum("982636347284") is False
def test_checksum(): """ Inputs that are the correct format and length """ assert checksum("786936224306") is True assert checksum("085392132225") is True assert checksum("717951000841") is False assert checksum("065743240502") is True assert checksum("811138000202") is True assert checksum("888888888888") is False assert checksum("134087934837") is False
def test_input(): """ Inputs that have an invalid value """ with exercise2.raises(ValueError): checksum("1") with exercise2.raises(ValueError): checksum("1234567890") with exercise2.raises(ValueError): checksum("142323") with exercise2.raises(ValueError): checksum("42412421341329324")
def test_checksum(): """ Inputs that are the correct format and length """ # Some positive tests and some negative tests assert checksum("786936224306") is True assert checksum("085392132225") is True assert checksum("717951000841") is False assert checksum("121846511984") is True assert checksum("121846511980") is False assert checksum("121846511984") is False assert checksum("121846511980") is True
def test_checksum(): """ Inputs that are the correct format and length """ assert checksum("786936224306") is True assert checksum("085392132225") is True assert checksum("086637677174") is True assert checksum("717951000841") is False assert checksum("130390080989") is False assert checksum("920225140794") is False
def test_format(): """ Inputs that consist incorrect non-numeric characters """ with pytest.raises(TypeError): checksum("123x56789!12") with pytest.raises(TypeError): checksum("x23356789312") with pytest.raises(TypeError): checksum("x233567@o312")
def test_checksum(): """ Inputs that are the correct format and length """ assert checksum("786936224306") is True assert checksum("085392132225") is True assert checksum("717951000841") is False # other tests assert checksum("124578906532") is False assert checksum("001480098006") is True assert checksum("001570094004") is False
def test_checksum(): """ Inputs that are the correct format and length """ assert checksum("786936224306") is True assert checksum("085392132225") is True assert checksum("717951000841") is False # other tests assert checksum("982437435435") is False assert checksum("922432635435") is False assert checksum("638925015658") is True
def test_input(): """ Inputs that are the incorrect format and length """ with exercise2.raises(TypeError): checksum(1.0) with exercise2.raises(TypeError): checksum(786936224306) with exercise2.raises(TypeError): checksum(444444)
def test_input(): """ Inputs that are the incorrect format and length """ with pytest.raises(TypeError): checksum(1.0) with pytest.raises(TypeError): checksum(786936224306) with pytest.raises(TypeError): checksum(1) with pytest.raises(TypeError): checksum(-1) with pytest.raises(TypeError): checksum(-3.2) with pytest.raises(ValueError): checksum("1") with pytest.raises(ValueError): checksum("1234567890") with pytest.raises(ValueError): checksum("43783920192837483")
def test_input(): """ Inputs that are the incorrect format and length """ # type error test with pytest.raises(TypeError): checksum(1.0) # float checksum(786936224306) # int checksum(True) # boolean # value error test with pytest.raises(ValueError): checksum("1") # len 1 checksum("1234567890") # len 10 checksum("1234567890123") # len 13
def test_input(): """ Inputs that are the incorrect format and length """ with pytest.raises(TypeError): checksum(1.0) with pytest.raises(TypeError): checksum(786936224306) with pytest.raises(ValueError): checksum("1") with pytest.raises(ValueError): checksum("1234567890") with pytest.raises(ValueError): checksum("09876543210987") with pytest.raises(ValueError): checksum("Testing words")
def test_input(): """ Inputs that are the incorrect format and length """ with pytest.raises(TypeError): checksum(1.0) with pytest.raises(TypeError): checksum(786936224306) with pytest.raises(TypeError): checksum(True) with pytest.raises(ValueError): checksum("1") with pytest.raises(ValueError): checksum("1234567890") with pytest.raises(ValueError): checksum(123) with pytest.raises(ValueError): checksum("True") with pytest.raises(ValueError): checksum("upc") with pytest.raises(ValueError): checksum("100.0")
def test_input(): """ Inputs that are the incorrect format and length """ #Checks if input is correct type with pytest.raises(TypeError): checksum(1.0) with pytest.raises(TypeError): checksum(786936224306) #Checks if there are errors in value length with pytest.raises(ValueError): checksum("1") with pytest.raises(ValueError): checksum("1234567890") with pytest.raises(ValueError): checksum("-12345678901") with pytest.raises(ValueError): checksum("1234567s8901")
def test_checksum(): """ Test some UPCs to insure the results are coming out correctly """ assert checksum("786936224306") is True assert checksum("085392132225") is True assert checksum("639382000393") is True assert checksum("123456789012") is True assert checksum("763089537613") is True assert checksum("653100976548") is True assert checksum("000000000000") is True assert checksum("000213035158") is True assert checksum("010608030606") is True assert checksum("407020803091") is True assert checksum("717951000841") is False assert checksum("085392132220") is False assert checksum("639382000396") is False assert checksum("123456789011") is False assert checksum("763089537617") is False assert checksum("653100976549") is False assert checksum("000000000001") is False assert checksum("000213035154") is False assert checksum("010608030609") is False assert checksum("407020803092") is False
def test_checksum(): """ Inputs that are the correct format and length """ assert checksum("036000291452") is True assert checksum("786936224306") is True assert checksum("085392132225") is True assert checksum("123456789012") is True assert checksum("124297385722") is True assert checksum("854336576384") is True assert checksum("717951000841") is False assert checksum("075678164120") is False assert checksum("568439479545") is False assert checksum("301248381248") is False assert checksum("562374673266") is False assert checksum("249572305686") is False
def test_input(): """ Inputs are not the correct format and length """ with pytest.raises(TypeError): checksum(1.0) # no floats allowed checksum(786936224306.0) # no floats allowed checksum(786936224306) # no ints allowed checksum((7,8,6,9,3,6,2,2,4,3,0,6)) # no lists allowed with pytest.raises(ValueError): checksum("") # must not be less than 12 digits checksum("1") # must not be less than 12 digits checksum("1234567890") # must not be less than 12 digits checksum("1234567890123123557") # must not be more than 12 digits checksum("40702080309a") # must not contain any non-digit characters checksum("40702080309!") # must not contain any non-digit characters checksum("abcdefghijkl") # must not contain any non-digit characters checksum("763O895376l7") # must not contain the letters 'O' and 'l'
def test_input(): """ Inputs that are the incorrect format and length. """ with pytest.raises(TypeError): checksum(1.0) with pytest.raises(TypeError): checksum(786936224306) with pytest.raises(TypeError): checksum(0.5) with pytest.raises(TypeError): checksum(4.5) with pytest.raises(ValueError): checksum("1") with pytest.raises(ValueError): checksum("1234567890") with pytest.raises(ValueError): checksum("38469") with pytest.raises(ValueError): checksum("21649200") with pytest.raises(ValueError): checksum("1") with pytest.raises(ValueError): checksum("1234567890") with pytest.raises(ValueError): checksum("1b34567890") with pytest.raises(ValueError): checksum("xdheuan123") with pytest.raises(ValueError): checksum("0000001c00")
def test_non_numeric_input(): with pytest.raises(ValueError): checksum("asdfasdfasdf") with pytest.raises(ValueError): checksum("12345abcde12")
def test_input(): """ Inputs that are the incorrect format or length """ with pytest.raises(TypeError): checksum(1.0) with pytest.raises(TypeError): checksum(786936224306) with pytest.raises(TypeError): checksum([1, 2]) with pytest.raises(TypeError): checksum(True) with pytest.raises(ValueError): checksum("1") with pytest.raises(ValueError): checksum("1234567890") with pytest.raises(ValueError): checksum("noteven") with pytest.raises(ValueError): checksum("thisonehastobetoolong") # other tests # add functions for any other tests
def test_input(): """ Inputs that are the incorrect format and length """ with pytest.raises(TypeError): checksum(1.0) checksum(786936224306) checksum(upccode) with pytest.raises(ValueError): checksum("1") checksum("1234567890") # other tests checksum("12343453389X") checksum("12343C53389X")
def test_zero(): assert checksum("000000000000") is False