Skip to content

Commit

Permalink
Go with token-name capitalization
Browse files Browse the repository at this point in the history
although normally test standards are to use lowercase it makes sense here to follow capitalized token names in tests that test those kinds of tokens.
  • Loading branch information
rocky committed Oct 29, 2024
1 parent 7027e96 commit c38d5a5
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions test/test_tokeniser.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
# Helper functions


def check_number(mathics3_code: str):
def check_Number(mathics3_code: str):
token = single_token(mathics3_code)
assert token, Token("Number", mathics3_code, 0)


def check_string(mathics3_code: str):
def check_String(mathics3_code: str):
token = single_token(mathics3_code)
assert token, Token("String", mathics3_code, 0)


def check_symbol(mathics3_code: str):
def check_Symbol(mathics3_code: str):
token = single_token(mathics3_code)
assert token, Token("Symbol", mathics3_code, 0)

Expand Down Expand Up @@ -86,9 +86,9 @@ def tags(mathics3_code: str):

def test_accuracy():
scan_error("1.5``")
check_number("1.0``20")
check_number("1.0``0")
check_number("1.4``-20")
check_Number("1.0``20")
check_Number("1.0``0")
check_Number("1.4``-20")


def test_apply():
Expand Down Expand Up @@ -200,7 +200,7 @@ def test_is_symbol():
assert not is_symbol_name("98") # symbols can't start with numbers


def test_file():
def test_Filename():
"""
Test that we can parse file names, and that we get into and out of
"filename" parsing mode.
Expand Down Expand Up @@ -230,29 +230,29 @@ def test_function():
]


def test_number():
def test_Number():
assert tags("1.5") == ["Number"]
assert tags("1.5*^10") == ["Number"]
check_number("0")
check_Number("0")


def test_number_base():
check_number("8^^23")
check_number("10*^3")
check_number("10*^-3")
check_number("8^^23*^2")
check_Number("8^^23")
check_Number("10*^3")
check_Number("10*^-3")
check_Number("8^^23*^2")


def test_number_big():
for _ in range(10):
check_number(str(random.randint(0, sys.maxsize)))
check_number(str(random.randint(sys.maxsize, sys.maxsize * sys.maxsize)))
check_Number(str(random.randint(0, sys.maxsize)))
check_Number(str(random.randint(sys.maxsize, sys.maxsize * sys.maxsize)))


def test_number_real():
check_number("1.5")
check_number("1.5`")
check_number("0.0")
check_Number("1.5")
check_Number("1.5`")
check_Number("0.0")


def test_pre():
Expand All @@ -264,16 +264,16 @@ def test_pre():


def test_precision():
check_number("1.5`-5")
check_number("1.5`0")
check_number("1.5`10")
check_Number("1.5`-5")
check_Number("1.5`0")
check_Number("1.5`10")


def test_string():
check_string(r'"abc"')
def test_String():
check_String(r'"abc"')
incomplete_error(r'"abc')
check_string(r'"abc(*def*)"')
check_string(r'"a\"b\\c"')
check_String(r'"abc(*def*)"')
check_String(r'"a\"b\\c"')
incomplete_error(r'"\"')


Expand All @@ -293,10 +293,10 @@ def test_set():


def test_symbol():
check_symbol("xX")
check_symbol("context`name")
check_symbol("`name")
check_symbol("`context`name")
check_Symbol("xX")
check_Symbol("context`name")
check_Symbol("`name")
check_Symbol("`context`name")


def test_unset():
Expand Down

0 comments on commit c38d5a5

Please sign in to comment.