from scout.utils.convert import isfloat, isint, make_bool, convert_number


def test_is_float_float():
    ## GIVEN a string with a float
    a = "1.2"
    ## WHEN checking if float
    res = isfloat(a)
    ## THEN assert it is a float
    assert res is True


def test_is_float_int():
    ## GIVEN a string with a integer
    a = "4"
    ## WHEN checking if float
    res = isfloat(a)
    ## THEN assert it is a float
    assert res is True


def test_is_float_char():
    ## GIVEN a string with a non number
    a = "b"
    ## WHEN checking if float
    res = isfloat(a)
    ## THEN assert it is not a float
    assert res is False


def test_is_float_empty():
    ## GIVEN a empty string
    a = ""
    ## WHEN checking if float
    res = isfloat(a)
    ## THEN assert it is not a float
    assert res is False


def test_is_int_float():
    ## GIVEN a string with a float
    a = "1.2"
    ## WHEN checking if integer
    res = isint(a)
    ## THEN assert it is not a integer
    assert res is False


def test_is_int_int():
    ## GIVEN a string with a int
    a = "4"
    ## WHEN checking if int
    res = isint(a)
    ## THEN assert it is a int
    assert res is True


def test_is_int_char():
    ## GIVEN a string with a character
    a = "b"
    ## WHEN checking if integer
    res = isfloat(a)
    ## THEN assert it is not a integer
    assert res is False


def test_is_int_empty():
    ## GIVEN a string with a empty string
    a = ""
    ## WHEN checking if integer
    res = isint(a)
    ## THEN assert it is not a integer
    assert res is False


def test_is_int_tricky():
    ## GIVEN a string with a empty string
    a = "1.0"
    ## WHEN checking if integer
    res = isint(a)
    ## THEN assert it is not a integer
    assert res is True


def test_convert_number_float():
    ## GIVEN a string with a float
    a = "1.2"
    ## WHEN converting to number
    res = convert_number(a)
    ## THEN assert it is the float
    assert res == 1.2


def test_convert_number_int():
    ## GIVEN a string with a integer
    a = "4"
    ## WHEN converting to number
    res = convert_number(a)
    ## THEN assert it is the float
    assert res == 4


def test_convert_number_empty():
    ## GIVEN a empty string
    a = ""
    ## WHEN converting to number
    res = convert_number(a)
    ## THEN assert it is None
    assert res is None


def test_convert_number_tricky():
    ## GIVEN a empty string
    a = "1.0"
    ## WHEN converting to number
    res = convert_number(a)
    ## THEN assert it is None
    assert res is 1


def test_make_bool_one():
    ## GIVEN a string representing a boolean
    a = "1"
    ## WHEN making a boolean
    res = make_bool(a)
    ## THEN assert it is True
    assert res is True


def test_make_bool_zero():
    ## GIVEN a string representing a boolean
    a = "0"
    ## WHEN converting to a boolean
    res = make_bool(a)
    ## THEN assert it is False
    assert res is False


def test_make_bool_empty():
    ## GIVEN a empty string
    a = ""
    ## WHEN converting to a boolean
    res = make_bool(a)
    ## THEN assert it is False
    assert res is False


def test_make_bool_nonsense():
    ## GIVEN a nonsense string
    a = "nonsense asdlkfjalk"
    ## WHEN converting to a boolean
    res = make_bool(a)
    ## THEN assert it is False
    assert res is False


def test_make_bool_yes():
    ## GIVEN a empty string
    a = "yes"
    ## WHEN converting to a boolean
    res = make_bool(a)
    ## THEN assert it is True
    assert res is True


def test_make_bool_YES():
    ## GIVEN a empty string
    a = "YES"
    ## WHEN converting to a boolean
    res = make_bool(a)
    ## THEN assert it is True
    assert res is True

@@ -29,16 +29,22 @@
 ort 
+(%0A    
 isfloat,
  isi
@@ -43,15 +43,23 @@
 oat,
+%0A   
  isint,
+%0A   
  mak
@@ -65,16 +65,20 @@
 ke_bool,
+%0A   
  convert
@@ -84,16 +84,57 @@
 t_number
+,%0A    amino_acid_residue_change_3_to_1,%0A)
 %0A%0A%0Adef t
@@ -3713,28 +3713,302 @@
 True%0A    assert res is True%0A
+%0A%0Adef test_amino_acid_residue_change_3_to_1():%0A    ## GIVEN a protein change on HGVS 3-letter format%0A    a = %22p.Ser241Phe%22%0A    ## WHEN converting to 1-letter change string%0A    r = amino_acid_residue_change_3_to_1(a)%0A    ## THEN the result is correct%0A    assert r == %22S241F%22%0A

Add test