mirror of https://github.com/eyhc1/rendercv.git
fix windows tests
This commit is contained in:
parent
fa7269fc85
commit
3ef0915fc2
|
@ -39,7 +39,6 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
pip install pytest pytest-cov
|
pip install pytest pytest-cov
|
||||||
pytest --cov-report html --cov="." tests/
|
pytest --cov-report html --cov="." tests/
|
||||||
continue-on-error: true
|
|
||||||
- name: Upload coverage data to smokeshow
|
- name: Upload coverage data to smokeshow
|
||||||
if: ${{matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'}} # upload coverage once
|
if: ${{matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'}} # upload coverage once
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -346,7 +346,7 @@ def render_template(data: RenderCVDataModel, output_path: str = None) -> str:
|
||||||
return output_file_path
|
return output_file_path
|
||||||
|
|
||||||
|
|
||||||
def run_latex(latex_file_path):
|
def run_latex(latex_file_path: str) -> str:
|
||||||
"""
|
"""
|
||||||
Run TinyTeX with the given LaTeX file and generate a PDF.
|
Run TinyTeX with the given LaTeX file and generate a PDF.
|
||||||
|
|
||||||
|
@ -365,13 +365,6 @@ def run_latex(latex_file_path):
|
||||||
output_file_name = latex_file_name.replace(".tex", ".pdf")
|
output_file_name = latex_file_name.replace(".tex", ".pdf")
|
||||||
output_file_path = os.path.join(os.path.dirname(latex_file_path), output_file_name)
|
output_file_path = os.path.join(os.path.dirname(latex_file_path), output_file_name)
|
||||||
|
|
||||||
# remove all files except the .tex file
|
|
||||||
for file in os.listdir(os.path.dirname(latex_file_path)):
|
|
||||||
if file.endswith(".tex") or file == "fonts":
|
|
||||||
continue
|
|
||||||
# remove the file:
|
|
||||||
os.remove(os.path.join(os.path.dirname(latex_file_path), file))
|
|
||||||
|
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
tinytex_path = os.path.join(
|
tinytex_path = os.path.join(
|
||||||
os.path.dirname(__file__),
|
os.path.dirname(__file__),
|
||||||
|
@ -407,23 +400,24 @@ def run_latex(latex_file_path):
|
||||||
],
|
],
|
||||||
cwd=os.path.dirname(latex_file_path),
|
cwd=os.path.dirname(latex_file_path),
|
||||||
check=True,
|
check=True,
|
||||||
stdout=subprocess.PIPE, # suppress latexmk output
|
stdout=subprocess.DEVNULL, # suppress latexmk output
|
||||||
stderr=subprocess.STDOUT, # suppress latexmk output
|
|
||||||
)
|
)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Running TinyTeX has failed with the following error:\n\n"
|
"Running TinyTeX has failed with the following error:\n\n"
|
||||||
f"command \"{e.cmd}\" return with error (code {e.returncode}): {e.output}\n\n"
|
f'command "{e.cmd}" return with error (code {e.returncode}): {e.output}\n\n'
|
||||||
"If you can't find the problem, please try to re-install RenderCV, or"
|
"If you can't find the problem, please try to re-install RenderCV, or"
|
||||||
" open an issue on GitHub."
|
" open an issue on GitHub."
|
||||||
)
|
)
|
||||||
|
|
||||||
# remove the unnecessary files:
|
# remove the unnecessary files:
|
||||||
for file in os.listdir(os.path.dirname(latex_file_path)):
|
for file_name in os.listdir(os.path.dirname(latex_file_path)):
|
||||||
if file.endswith(".tex") or file.endswith(".pdf") or file == "fonts":
|
if (
|
||||||
continue
|
file_name.endswith(".aux")
|
||||||
# remove the file:
|
or file_name.endswith(".log")
|
||||||
os.remove(os.path.join(os.path.dirname(latex_file_path), file))
|
or file_name.endswith(".out")
|
||||||
|
):
|
||||||
|
os.remove(os.path.join(os.path.dirname(latex_file_path), file_name))
|
||||||
|
|
||||||
end_time = time.time()
|
end_time = time.time()
|
||||||
time_taken = end_time - start_time
|
time_taken = end_time - start_time
|
||||||
|
|
|
@ -7,398 +7,396 @@ from rendercv import rendering, data_model
|
||||||
|
|
||||||
|
|
||||||
class TestDataModel(unittest.TestCase):
|
class TestDataModel(unittest.TestCase):
|
||||||
# def test_markdown_to_latex(self):
|
def test_markdown_to_latex(self):
|
||||||
# input = "[link](www.example.com)"
|
input = "[link](www.example.com)"
|
||||||
# expected = r"\hrefExternal{www.example.com}{link}"
|
expected = r"\hrefExternal{www.example.com}{link}"
|
||||||
# output = rendering.markdown_to_latex(input)
|
output = rendering.markdown_to_latex(input)
|
||||||
# with self.subTest(msg="only one link"):
|
with self.subTest(msg="only one link"):
|
||||||
# self.assertEqual(output, expected)
|
self.assertEqual(output, expected)
|
||||||
|
|
||||||
# input = "[link](www.example.com) and [link2](www.example2.com)"
|
input = "[link](www.example.com) and [link2](www.example2.com)"
|
||||||
# expected = (
|
expected = (
|
||||||
# r"\hrefExternal{www.example.com}{link} and"
|
r"\hrefExternal{www.example.com}{link} and"
|
||||||
# r" \hrefExternal{www.example2.com}{link2}"
|
r" \hrefExternal{www.example2.com}{link2}"
|
||||||
# )
|
)
|
||||||
# output = rendering.markdown_to_latex(input)
|
output = rendering.markdown_to_latex(input)
|
||||||
# with self.subTest(msg="two links"):
|
with self.subTest(msg="two links"):
|
||||||
# self.assertEqual(output, expected)
|
self.assertEqual(output, expected)
|
||||||
|
|
||||||
# input = "[**link**](www.example.com)"
|
input = "[**link**](www.example.com)"
|
||||||
# expected = r"\hrefExternal{www.example.com}{\textbf{link}}"
|
expected = r"\hrefExternal{www.example.com}{\textbf{link}}"
|
||||||
# output = rendering.markdown_to_latex(input)
|
output = rendering.markdown_to_latex(input)
|
||||||
# with self.subTest(msg="bold link"):
|
with self.subTest(msg="bold link"):
|
||||||
# self.assertEqual(output, expected)
|
self.assertEqual(output, expected)
|
||||||
|
|
||||||
# input = "[*link*](www.example.com)"
|
input = "[*link*](www.example.com)"
|
||||||
# expected = r"\hrefExternal{www.example.com}{\textit{link}}"
|
expected = r"\hrefExternal{www.example.com}{\textit{link}}"
|
||||||
# output = rendering.markdown_to_latex(input)
|
output = rendering.markdown_to_latex(input)
|
||||||
# with self.subTest(msg="italic link"):
|
with self.subTest(msg="italic link"):
|
||||||
# self.assertEqual(output, expected)
|
self.assertEqual(output, expected)
|
||||||
|
|
||||||
# input = "[*link*](www.example.com) and [**link2**](www.example2.com)"
|
input = "[*link*](www.example.com) and [**link2**](www.example2.com)"
|
||||||
# expected = (
|
expected = (
|
||||||
# r"\hrefExternal{www.example.com}{\textit{link}} and"
|
r"\hrefExternal{www.example.com}{\textit{link}} and"
|
||||||
# r" \hrefExternal{www.example2.com}{\textbf{link2}}"
|
r" \hrefExternal{www.example2.com}{\textbf{link2}}"
|
||||||
# )
|
)
|
||||||
# output = rendering.markdown_to_latex(input)
|
output = rendering.markdown_to_latex(input)
|
||||||
# with self.subTest(msg="italic and bold links"):
|
with self.subTest(msg="italic and bold links"):
|
||||||
# self.assertEqual(output, expected)
|
self.assertEqual(output, expected)
|
||||||
|
|
||||||
# input = "**bold**, *italic*, and [link](www.example.com)"
|
input = "**bold**, *italic*, and [link](www.example.com)"
|
||||||
# expected = (
|
expected = (
|
||||||
# r"\textbf{bold}, \textit{italic}, and"
|
r"\textbf{bold}, \textit{italic}, and"
|
||||||
# r" \hrefExternal{www.example.com}{link}"
|
r" \hrefExternal{www.example.com}{link}"
|
||||||
# )
|
)
|
||||||
# output = rendering.markdown_to_latex(input)
|
output = rendering.markdown_to_latex(input)
|
||||||
# with self.subTest(msg="bold, italic, and link"):
|
with self.subTest(msg="bold, italic, and link"):
|
||||||
# self.assertEqual(output, expected)
|
self.assertEqual(output, expected)
|
||||||
|
|
||||||
# # invalid input:
|
# invalid input:
|
||||||
# input = 20
|
input = 20
|
||||||
# with self.subTest(msg="float input"):
|
with self.subTest(msg="float input"):
|
||||||
# with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
# rendering.markdown_to_latex(input)
|
rendering.markdown_to_latex(input)
|
||||||
|
|
||||||
# def test_markdown_link_to_url(self):
|
def test_markdown_link_to_url(self):
|
||||||
# input = "[link](www.example.com)"
|
input = "[link](www.example.com)"
|
||||||
# expected = "www.example.com"
|
expected = "www.example.com"
|
||||||
# output = rendering.markdown_link_to_url(input)
|
output = rendering.markdown_link_to_url(input)
|
||||||
# with self.subTest(msg="only one link"):
|
with self.subTest(msg="only one link"):
|
||||||
# self.assertEqual(output, expected)
|
self.assertEqual(output, expected)
|
||||||
|
|
||||||
# input = "[**link**](www.example.com)"
|
input = "[**link**](www.example.com)"
|
||||||
# expected = "www.example.com"
|
expected = "www.example.com"
|
||||||
# output = rendering.markdown_link_to_url(input)
|
output = rendering.markdown_link_to_url(input)
|
||||||
# with self.subTest(msg="bold link"):
|
with self.subTest(msg="bold link"):
|
||||||
# self.assertEqual(output, expected)
|
self.assertEqual(output, expected)
|
||||||
|
|
||||||
# input = "[*link*](www.example.com)"
|
input = "[*link*](www.example.com)"
|
||||||
# expected = "www.example.com"
|
expected = "www.example.com"
|
||||||
# output = rendering.markdown_link_to_url(input)
|
output = rendering.markdown_link_to_url(input)
|
||||||
# with self.subTest(msg="italic link"):
|
with self.subTest(msg="italic link"):
|
||||||
# self.assertEqual(output, expected)
|
self.assertEqual(output, expected)
|
||||||
|
|
||||||
# # invalid input:
|
# invalid input:
|
||||||
# input = 20
|
input = 20
|
||||||
# with self.subTest(msg="float input"):
|
with self.subTest(msg="float input"):
|
||||||
# with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
# rendering.markdown_link_to_url(input)
|
rendering.markdown_link_to_url(input)
|
||||||
|
|
||||||
# input = "not a markdown link"
|
input = "not a markdown link"
|
||||||
# with self.subTest(msg="invalid input"):
|
with self.subTest(msg="invalid input"):
|
||||||
# with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
# rendering.markdown_link_to_url(input)
|
rendering.markdown_link_to_url(input)
|
||||||
|
|
||||||
# input = "[]()"
|
input = "[]()"
|
||||||
# with self.subTest(msg="empty link"):
|
with self.subTest(msg="empty link"):
|
||||||
# with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
# rendering.markdown_link_to_url(input)
|
rendering.markdown_link_to_url(input)
|
||||||
|
|
||||||
# def test_make_it_bold(self):
|
def test_make_it_bold(self):
|
||||||
# input = "some text"
|
input = "some text"
|
||||||
# expected = r"\textbf{some text}"
|
expected = r"\textbf{some text}"
|
||||||
# output = rendering.make_it_bold(input)
|
output = rendering.make_it_bold(input)
|
||||||
# with self.subTest(msg="without match_str input"):
|
with self.subTest(msg="without match_str input"):
|
||||||
# self.assertEqual(output, expected)
|
self.assertEqual(output, expected)
|
||||||
|
|
||||||
# input = "some text"
|
input = "some text"
|
||||||
# match_str = "text"
|
match_str = "text"
|
||||||
# expected = r"some \textbf{text}"
|
expected = r"some \textbf{text}"
|
||||||
# output = rendering.make_it_bold(input, match_str)
|
output = rendering.make_it_bold(input, match_str)
|
||||||
# with self.subTest(msg="with match_str input"):
|
with self.subTest(msg="with match_str input"):
|
||||||
# self.assertEqual(output, expected)
|
self.assertEqual(output, expected)
|
||||||
|
|
||||||
# input = 20
|
input = 20
|
||||||
# with self.subTest(msg="float input"):
|
with self.subTest(msg="float input"):
|
||||||
# with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
# rendering.make_it_bold(input)
|
rendering.make_it_bold(input)
|
||||||
|
|
||||||
# def test_make_it_underlined(self):
|
def test_make_it_underlined(self):
|
||||||
# input = "some text"
|
input = "some text"
|
||||||
# expected = r"\underline{some text}"
|
expected = r"\underline{some text}"
|
||||||
# output = rendering.make_it_underlined(input)
|
output = rendering.make_it_underlined(input)
|
||||||
# with self.subTest(msg="without match_str input"):
|
with self.subTest(msg="without match_str input"):
|
||||||
# self.assertEqual(output, expected)
|
self.assertEqual(output, expected)
|
||||||
|
|
||||||
# input = "some text"
|
input = "some text"
|
||||||
# match_str = "text"
|
match_str = "text"
|
||||||
# expected = r"some \underline{text}"
|
expected = r"some \underline{text}"
|
||||||
# output = rendering.make_it_underlined(input, match_str)
|
output = rendering.make_it_underlined(input, match_str)
|
||||||
# with self.subTest(msg="with match_str input"):
|
with self.subTest(msg="with match_str input"):
|
||||||
# self.assertEqual(output, expected)
|
self.assertEqual(output, expected)
|
||||||
|
|
||||||
# input = 20
|
input = 20
|
||||||
# with self.subTest(msg="float input"):
|
with self.subTest(msg="float input"):
|
||||||
# with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
# rendering.make_it_underlined(input)
|
rendering.make_it_underlined(input)
|
||||||
|
|
||||||
# def test_make_it_italic(self):
|
def test_make_it_italic(self):
|
||||||
# input = "some text"
|
input = "some text"
|
||||||
# expected = r"\textit{some text}"
|
expected = r"\textit{some text}"
|
||||||
# output = rendering.make_it_italic(input)
|
output = rendering.make_it_italic(input)
|
||||||
# with self.subTest(msg="without match_str input"):
|
with self.subTest(msg="without match_str input"):
|
||||||
# self.assertEqual(output, expected)
|
self.assertEqual(output, expected)
|
||||||
|
|
||||||
# input = "some text"
|
input = "some text"
|
||||||
# match_str = "text"
|
match_str = "text"
|
||||||
# expected = r"some \textit{text}"
|
expected = r"some \textit{text}"
|
||||||
# output = rendering.make_it_italic(input, match_str)
|
output = rendering.make_it_italic(input, match_str)
|
||||||
# with self.subTest(msg="with match_str input"):
|
with self.subTest(msg="with match_str input"):
|
||||||
# self.assertEqual(output, expected)
|
self.assertEqual(output, expected)
|
||||||
|
|
||||||
# input = 20
|
input = 20
|
||||||
# with self.subTest(msg="float input"):
|
with self.subTest(msg="float input"):
|
||||||
# with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
# rendering.make_it_italic(input)
|
rendering.make_it_italic(input)
|
||||||
|
|
||||||
# def test_divide_length_by(self):
|
def test_divide_length_by(self):
|
||||||
# lengths = [
|
lengths = [
|
||||||
# "10cm",
|
"10cm",
|
||||||
# "10.24in",
|
"10.24in",
|
||||||
# "10 pt",
|
"10 pt",
|
||||||
# "10.24 mm",
|
"10.24 mm",
|
||||||
# "10.24 em",
|
"10.24 em",
|
||||||
# "1024 ex",
|
"1024 ex",
|
||||||
# ]
|
]
|
||||||
# divider = 10
|
divider = 10
|
||||||
# expected = [
|
expected = [
|
||||||
# "1.0 cm",
|
"1.0 cm",
|
||||||
# "1.024 in",
|
"1.024 in",
|
||||||
# "1.0 pt",
|
"1.0 pt",
|
||||||
# "1.024 mm",
|
"1.024 mm",
|
||||||
# "1.024 em",
|
"1.024 em",
|
||||||
# "102.4 ex",
|
"102.4 ex",
|
||||||
# ]
|
]
|
||||||
# for length, exp in zip(lengths, expected):
|
for length, exp in zip(lengths, expected):
|
||||||
# with self.subTest(length=length):
|
with self.subTest(length=length):
|
||||||
# self.assertEqual(rendering.divide_length_by(length, divider), exp)
|
self.assertEqual(rendering.divide_length_by(length, divider), exp)
|
||||||
|
|
||||||
# def test_get_today(self):
|
def test_get_today(self):
|
||||||
# expected = date.today().strftime("%B %d, %Y")
|
expected = date.today().strftime("%B %d, %Y")
|
||||||
# result = rendering.get_today()
|
result = rendering.get_today()
|
||||||
# self.assertEqual(expected, result)
|
self.assertEqual(expected, result)
|
||||||
|
|
||||||
# def test_get_path_to_font_directory(self):
|
def test_get_path_to_font_directory(self):
|
||||||
# font_name = "test"
|
font_name = "test"
|
||||||
# expected = os.path.join(
|
expected = os.path.join(
|
||||||
# os.path.dirname(os.path.dirname(__file__)),
|
os.path.dirname(os.path.dirname(__file__)),
|
||||||
# "rendercv",
|
"rendercv",
|
||||||
# "templates",
|
"templates",
|
||||||
# "fonts",
|
"fonts",
|
||||||
# font_name,
|
font_name,
|
||||||
# )
|
)
|
||||||
# result = rendering.get_path_to_font_directory(font_name)
|
result = rendering.get_path_to_font_directory(font_name)
|
||||||
# self.assertEqual(expected, result)
|
self.assertEqual(expected, result)
|
||||||
|
|
||||||
# def test_render_template(self):
|
def test_render_template(self):
|
||||||
# test_input = {
|
test_input = {
|
||||||
# "cv": {
|
"cv": {
|
||||||
# "academic_projects": [
|
"academic_projects": [
|
||||||
# {
|
{
|
||||||
# "date": "Spring 2022",
|
"date": "Spring 2022",
|
||||||
# "highlights": ["Test 1", "Test 2"],
|
"highlights": ["Test 1", "Test 2"],
|
||||||
# "location": "Istanbul, Turkey",
|
"location": "Istanbul, Turkey",
|
||||||
# "name": "Academic Project 1",
|
"name": "Academic Project 1",
|
||||||
# "url": "https://example.com",
|
"url": "https://example.com",
|
||||||
# },
|
},
|
||||||
# {
|
{
|
||||||
# "highlights": ["Test 1", "Test 2"],
|
"highlights": ["Test 1", "Test 2"],
|
||||||
# "name": "Academic Project 2",
|
"name": "Academic Project 2",
|
||||||
# "url": "https://example.com",
|
"url": "https://example.com",
|
||||||
# },
|
},
|
||||||
# {
|
{
|
||||||
# "end_date": "2022-05-01",
|
"end_date": "2022-05-01",
|
||||||
# "highlights": ["Test 1", "Test 2"],
|
"highlights": ["Test 1", "Test 2"],
|
||||||
# "location": "Istanbul, Turkey",
|
"location": "Istanbul, Turkey",
|
||||||
# "name": "Academic Project 3",
|
"name": "Academic Project 3",
|
||||||
# "start_date": "2022-02-01",
|
"start_date": "2022-02-01",
|
||||||
# "url": "https://example.com",
|
"url": "https://example.com",
|
||||||
# },
|
},
|
||||||
# ],
|
],
|
||||||
# "certificates": [{"name": "Certificate 1"}],
|
"certificates": [{"name": "Certificate 1"}],
|
||||||
# "education": [
|
"education": [
|
||||||
# {
|
{
|
||||||
# "area": "Mechanical Engineering",
|
"area": "Mechanical Engineering",
|
||||||
# "end_date": "1985-01-01",
|
"end_date": "1985-01-01",
|
||||||
# "gpa": "3.80/4.00",
|
"gpa": "3.80/4.00",
|
||||||
# "highlights": ["Test 1", "Test 2"],
|
"highlights": ["Test 1", "Test 2"],
|
||||||
# "institution": "Bogazici University",
|
"institution": "Bogazici University",
|
||||||
# "location": "Istanbul, Turkey",
|
"location": "Istanbul, Turkey",
|
||||||
# "start_date": "1980-09-01",
|
"start_date": "1980-09-01",
|
||||||
# "study_type": "BS",
|
"study_type": "BS",
|
||||||
# "transcript_url": "https://example.com/",
|
"transcript_url": "https://example.com/",
|
||||||
# "url": "https://boun.edu.tr",
|
"url": "https://boun.edu.tr",
|
||||||
# },
|
},
|
||||||
# {
|
{
|
||||||
# "area": "Mechanical Engineering, Student Exchange Program",
|
"area": "Mechanical Engineering, Student Exchange Program",
|
||||||
# "end_date": "2022-01-15",
|
"end_date": "2022-01-15",
|
||||||
# "institution": "The University of Texas at Austin",
|
"institution": "The University of Texas at Austin",
|
||||||
# "location": "Austin, TX, USA",
|
"location": "Austin, TX, USA",
|
||||||
# "start_date": "2021-08-01",
|
"start_date": "2021-08-01",
|
||||||
# "url": "https://utexas.edu",
|
"url": "https://utexas.edu",
|
||||||
# },
|
},
|
||||||
# ],
|
],
|
||||||
# "email": "john@doe.com",
|
"email": "john@doe.com",
|
||||||
# "extracurricular_activities": [
|
"extracurricular_activities": [
|
||||||
# {
|
{
|
||||||
# "company": "Test Company 1",
|
"company": "Test Company 1",
|
||||||
# "highlights": [
|
"highlights": [
|
||||||
# "Lead and train members for intercollegiate alpine ski"
|
"Lead and train members for intercollegiate alpine ski"
|
||||||
# " races in Turkey and organize skiing events."
|
" races in Turkey and organize skiing events."
|
||||||
# ],
|
],
|
||||||
# "position": "Test Position 1",
|
"position": "Test Position 1",
|
||||||
# },
|
},
|
||||||
# {
|
{
|
||||||
# "company": "Test Company 1",
|
"company": "Test Company 1",
|
||||||
# "date": "Summer 2019 and 2020",
|
"date": "Summer 2019 and 2020",
|
||||||
# "highlights": ["Test 1", "Test 2", "Test 3"],
|
"highlights": ["Test 1", "Test 2", "Test 3"],
|
||||||
# "location": "Izmir, Turkey",
|
"location": "Izmir, Turkey",
|
||||||
# "position": "Test Position 1",
|
"position": "Test Position 1",
|
||||||
# },
|
},
|
||||||
# ],
|
],
|
||||||
# "label": "Engineer at CERN",
|
"label": "Engineer at CERN",
|
||||||
# "location": "Geneva, Switzerland",
|
"location": "Geneva, Switzerland",
|
||||||
# "name": "John Doe",
|
"name": "John Doe",
|
||||||
# "personal_projects": [{"name": "Personal Project 1"}],
|
"personal_projects": [{"name": "Personal Project 1"}],
|
||||||
# "phone": "+905413769286",
|
"phone": "+905413769286",
|
||||||
# "publications": [
|
"publications": [
|
||||||
# {
|
{
|
||||||
# "authors": [
|
"authors": [
|
||||||
# "Cetin Yilmaz",
|
"Cetin Yilmaz",
|
||||||
# "Gregory M Hulbert",
|
"Gregory M Hulbert",
|
||||||
# "Noboru Kikuchi",
|
"Noboru Kikuchi",
|
||||||
# ],
|
],
|
||||||
# "cited_by": 243,
|
"cited_by": 243,
|
||||||
# "date": "2007-08-01",
|
"date": "2007-08-01",
|
||||||
# "doi": "10.1103/PhysRevB.76.054309",
|
"doi": "10.1103/PhysRevB.76.054309",
|
||||||
# "journal": "Physical Review B",
|
"journal": "Physical Review B",
|
||||||
# "title": (
|
"title": (
|
||||||
# "Phononic band gaps induced by inertial amplification in"
|
"Phononic band gaps induced by inertial amplification in"
|
||||||
# " periodic media"
|
" periodic media"
|
||||||
# ),
|
),
|
||||||
# }
|
}
|
||||||
# ],
|
],
|
||||||
# "section_order": [
|
"section_order": [
|
||||||
# "Education",
|
"Education",
|
||||||
# "Work Experience",
|
"Work Experience",
|
||||||
# "Academic Projects",
|
"Academic Projects",
|
||||||
# "Certificates",
|
"Certificates",
|
||||||
# "Personal Projects",
|
"Personal Projects",
|
||||||
# "Skills",
|
"Skills",
|
||||||
# "Test Scores",
|
"Test Scores",
|
||||||
# "Extracurricular Activities",
|
"Extracurricular Activities",
|
||||||
# "Publications",
|
"Publications",
|
||||||
# ],
|
],
|
||||||
# "skills": [
|
"skills": [
|
||||||
# {
|
{
|
||||||
# "details": "C++, C, Python, JavaScript, MATLAB, Lua, LaTeX",
|
"details": "C++, C, Python, JavaScript, MATLAB, Lua, LaTeX",
|
||||||
# "name": "Programming",
|
"name": "Programming",
|
||||||
# },
|
},
|
||||||
# {"details": "GMSH, GetDP, CalculiX", "name": "CAE"},
|
{"details": "GMSH, GetDP, CalculiX", "name": "CAE"},
|
||||||
# ],
|
],
|
||||||
# "social_networks": [
|
"social_networks": [
|
||||||
# {"network": "LinkedIn", "username": "dummy"},
|
{"network": "LinkedIn", "username": "dummy"},
|
||||||
# {"network": "GitHub", "username": "sinaatalay"},
|
{"network": "GitHub", "username": "sinaatalay"},
|
||||||
# ],
|
],
|
||||||
# "test_scores": [
|
"test_scores": [
|
||||||
# {"date": "2022-10-01", "details": "120/120", "name": "TOEFL"},
|
{"date": "2022-10-01", "details": "120/120", "name": "TOEFL"},
|
||||||
# {
|
{
|
||||||
# "details": "9.0/9.0",
|
"details": "9.0/9.0",
|
||||||
# "name": "IELTS",
|
"name": "IELTS",
|
||||||
# "url": "https://example.com",
|
"url": "https://example.com",
|
||||||
# },
|
},
|
||||||
# ],
|
],
|
||||||
# "website": "https://example.com",
|
"website": "https://example.com",
|
||||||
# "work_experience": [
|
"work_experience": [
|
||||||
# {
|
{
|
||||||
# "company": "Company 1",
|
"company": "Company 1",
|
||||||
# "end_date": "present",
|
"end_date": "present",
|
||||||
# "highlights": ["Test 1", "Test 2", "Test 3"],
|
"highlights": ["Test 1", "Test 2", "Test 3"],
|
||||||
# "location": "Geneva, Switzerland",
|
"location": "Geneva, Switzerland",
|
||||||
# "position": "Position 1",
|
"position": "Position 1",
|
||||||
# "start_date": "2023-02-01",
|
"start_date": "2023-02-01",
|
||||||
# "url": "https://example.com",
|
"url": "https://example.com",
|
||||||
# },
|
},
|
||||||
# {
|
{
|
||||||
# "company": "Company 2",
|
"company": "Company 2",
|
||||||
# "end_date": "2023-02-01",
|
"end_date": "2023-02-01",
|
||||||
# "highlights": ["Test 1", "Test 2", "Test 3"],
|
"highlights": ["Test 1", "Test 2", "Test 3"],
|
||||||
# "location": "Geneva, Switzerland",
|
"location": "Geneva, Switzerland",
|
||||||
# "position": "Position 2",
|
"position": "Position 2",
|
||||||
# "start_date": "1986-02-01",
|
"start_date": "1986-02-01",
|
||||||
# "url": "https://example.com",
|
"url": "https://example.com",
|
||||||
# },
|
},
|
||||||
# ],
|
],
|
||||||
# },
|
},
|
||||||
# "design": {
|
"design": {
|
||||||
# "font": "EBGaramond",
|
"font": "EBGaramond",
|
||||||
# "options": {
|
"options": {
|
||||||
# "date_and_location_width": "3.6 cm",
|
"date_and_location_width": "3.6 cm",
|
||||||
# "margins": {
|
"margins": {
|
||||||
# "entry_area": {
|
"entry_area": {
|
||||||
# "left": "0.2 cm",
|
"left": "0.2 cm",
|
||||||
# "right": "0.2 cm",
|
"right": "0.2 cm",
|
||||||
# "vertical_between": "0.12 cm",
|
"vertical_between": "0.12 cm",
|
||||||
# },
|
},
|
||||||
# "highlights_area": {
|
"highlights_area": {
|
||||||
# "left": "0.6 cm",
|
"left": "0.6 cm",
|
||||||
# "top": "0.12 cm",
|
"top": "0.12 cm",
|
||||||
# "vertical_between_bullet_points": "0.07 cm",
|
"vertical_between_bullet_points": "0.07 cm",
|
||||||
# },
|
},
|
||||||
# "page": {
|
"page": {
|
||||||
# "bottom": "1.35 cm",
|
"bottom": "1.35 cm",
|
||||||
# "left": "1.35 cm",
|
"left": "1.35 cm",
|
||||||
# "right": "1.35 cm",
|
"right": "1.35 cm",
|
||||||
# "top": "1.35 cm",
|
"top": "1.35 cm",
|
||||||
# },
|
},
|
||||||
# "section_title": {"bottom": "0.13 cm", "top": "0.13 cm"},
|
"section_title": {"bottom": "0.13 cm", "top": "0.13 cm"},
|
||||||
# },
|
},
|
||||||
# "primary_color": "rgb(0,79,144)",
|
"primary_color": "rgb(0,79,144)",
|
||||||
# "show_last_updated_date": True,
|
"show_last_updated_date": True,
|
||||||
# "show_timespan_in_experience_entries": True,
|
"show_timespan_in_experience_entries": True,
|
||||||
# },
|
},
|
||||||
# "theme": "classic",
|
"theme": "classic",
|
||||||
# },
|
},
|
||||||
# }
|
}
|
||||||
# data = data_model.RenderCVDataModel(**test_input)
|
data = data_model.RenderCVDataModel(**test_input)
|
||||||
# rendering.render_template(data=data, output_path=os.path.dirname(__file__))
|
rendering.render_template(data=data, output_path=os.path.dirname(__file__))
|
||||||
|
|
||||||
# # Check if the output file exists:
|
# Check if the output file exists:
|
||||||
# output_folder_path = os.path.join(os.path.dirname(__file__), "output")
|
output_folder_path = os.path.join(os.path.dirname(__file__), "output")
|
||||||
# output_file_path = os.path.join(output_folder_path, "John_Doe_CV.tex")
|
output_file_path = os.path.join(output_folder_path, "John_Doe_CV.tex")
|
||||||
# self.assertTrue(os.path.exists(output_file_path))
|
self.assertTrue(os.path.exists(output_file_path))
|
||||||
|
|
||||||
# # Compare the output file with the reference file:
|
# Compare the output file with the reference file:
|
||||||
# reference_file_path = os.path.join(
|
reference_file_path = os.path.join(
|
||||||
# os.path.dirname(__file__), "reference_files", "John_Doe_CV.tex"
|
os.path.dirname(__file__), "reference_files", "John_Doe_CV.tex"
|
||||||
# )
|
)
|
||||||
# with open(output_file_path, "r") as file:
|
with open(output_file_path, "r") as file:
|
||||||
# output = file.read()
|
output = file.read()
|
||||||
# with open(reference_file_path, "r") as file:
|
with open(reference_file_path, "r") as file:
|
||||||
# reference = file.read()
|
reference = file.read()
|
||||||
# reference = reference.replace(
|
reference = reference.replace("REPLACETHISWITHTODAY", rendering.get_today())
|
||||||
# "REPLACETHISWITHTODAY", rendering.get_today()
|
|
||||||
# )
|
|
||||||
|
|
||||||
# self.assertEqual(output, reference)
|
self.assertEqual(output, reference)
|
||||||
|
|
||||||
# # Check if the font directory exists:
|
# Check if the font directory exists:
|
||||||
# font_directory_path = os.path.join(output_folder_path, "fonts")
|
font_directory_path = os.path.join(output_folder_path, "fonts")
|
||||||
# self.assertTrue(os.path.exists(font_directory_path))
|
self.assertTrue(os.path.exists(font_directory_path))
|
||||||
|
|
||||||
# required_files = [
|
required_files = [
|
||||||
# "EBGaramond-Italic.ttf",
|
"EBGaramond-Italic.ttf",
|
||||||
# "EBGaramond-Regular.ttf",
|
"EBGaramond-Regular.ttf",
|
||||||
# "EBGaramond-Bold.ttf",
|
"EBGaramond-Bold.ttf",
|
||||||
# "EBGaramond-BoldItalic.ttf",
|
"EBGaramond-BoldItalic.ttf",
|
||||||
# ]
|
]
|
||||||
# font_files = os.listdir(font_directory_path)
|
font_files = os.listdir(font_directory_path)
|
||||||
# for required_file in required_files:
|
for required_file in required_files:
|
||||||
# with self.subTest(required_file=required_file):
|
with self.subTest(required_file=required_file):
|
||||||
# self.assertIn(required_file, font_files)
|
self.assertIn(required_file, font_files)
|
||||||
|
|
||||||
# # Remove the output directory:
|
# Remove the output directory:
|
||||||
# shutil.rmtree(output_folder_path)
|
shutil.rmtree(output_folder_path)
|
||||||
|
|
||||||
def test_run_latex(self):
|
def test_run_latex(self):
|
||||||
latex_file_path = os.path.join(
|
latex_file_path = os.path.join(
|
||||||
|
@ -411,6 +409,12 @@ class TestDataModel(unittest.TestCase):
|
||||||
# Check if the output file exists:
|
# Check if the output file exists:
|
||||||
self.assertTrue(os.path.exists(pdf_file))
|
self.assertTrue(os.path.exists(pdf_file))
|
||||||
|
|
||||||
|
# Compare the pdf file with the reference pdf file:
|
||||||
|
reference_pdf_file = pdf_file.replace(".pdf", "_reference.pdf")
|
||||||
|
self.assertTrue(
|
||||||
|
os.path.getsize(pdf_file) == os.path.getsize(reference_pdf_file)
|
||||||
|
)
|
||||||
|
|
||||||
# Remove the output file:
|
# Remove the output file:
|
||||||
os.remove(pdf_file)
|
os.remove(pdf_file)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue