From fd504fa30aa1dbbc579c3333f5304997d485ddb5 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Sun, 21 Mar 2021 20:53:04 +1100 Subject: [PATCH] Add python test step --- .github/workflows/push.yml | 11 +++++++++++ Translations/make_translation_test.py | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 555f50e5..6d2a309e 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -47,6 +47,17 @@ jobs: source/Hexfile/LICENSE_RELEASE.md if-no-files-found: error + tests: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - name: Setup + run: sudo apt-get update && sudo apt-get install -y python3 + + - name: Run python tests + run: cd Translations && ./make_translation_test.py + check_formatting: runs-on: ubuntu-20.04 diff --git a/Translations/make_translation_test.py b/Translations/make_translation_test.py index 5cae449a..5778d3a0 100644 --- a/Translations/make_translation_test.py +++ b/Translations/make_translation_test.py @@ -1,9 +1,12 @@ +#!/usr/bin/env python3 +# coding=utf-8 import unittest class TestMakeTranslation(unittest.TestCase): def test_getCharsFromFontIndex(self): from make_translation import getCharsFromFontIndex + self.assertEqual(getCharsFromFontIndex(2), "\\x02") self.assertEqual(getCharsFromFontIndex(239), "\\xEF") self.assertEqual(getCharsFromFontIndex(240), "\\xF0") @@ -17,5 +20,5 @@ class TestMakeTranslation(unittest.TestCase): getCharsFromFontIndex(0x10 * 0xFF - 14) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main()