From a64657988a50522885618998e7f14168c299a19b Mon Sep 17 00:00:00 2001 From: "Eevee (Lexy Munroe)" Date: Wed, 24 Aug 2016 15:43:15 -0700 Subject: Fix most Python 3 compat issues with futurize --stage1 --- tests/test_vba.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/test_vba.py b/tests/test_vba.py index caa1867..461cb65 100644 --- a/tests/test_vba.py +++ b/tests/test_vba.py @@ -1,6 +1,7 @@ """ Tests for VBA automation tools """ +from __future__ import print_function import unittest @@ -267,13 +268,13 @@ class VbaTests(unittest.TestCase): start_state = self.cry.vba.state for name in names: - print "Writing name: " + name + print("Writing name: " + name) self.cry.vba.state = start_state sequence = self.cry.write(name) - print "sequence is: " + str(sequence) + print("sequence is: " + str(sequence)) # save this selection self.cry.vba.press("start", hold=20) -- cgit v1.2.3 From 85ee624293900c78e9b02f1fcb4aa00c5b2140a5 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sat, 27 Aug 2016 19:14:32 -0500 Subject: import unittest.mock as mock --- tests/integration/tests.py | 6 +++++- tests/tests.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/integration/tests.py b/tests/integration/tests.py index 79fadda..024feab 100644 --- a/tests/integration/tests.py +++ b/tests/integration/tests.py @@ -99,7 +99,11 @@ from pokemontools.crystal import ( import pokemontools.wram import unittest -import mock + +try: + import unittest.mock as mock +except ImportError: + import mock class BasicTestCase(unittest.TestCase): "this is where i cram all of my unit tests together" diff --git a/tests/tests.py b/tests/tests.py index 4c7f7a4..13b1e49 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -95,7 +95,11 @@ from pokemontools.crystal import ( ) import unittest -import mock + +try: + import unittest.mock as mock +except ImportError: + import mock class TestCram(unittest.TestCase): "this is where i cram all of my unit tests together" -- cgit v1.2.3 From 080bbf00ff93e334eb22e89fb980a64769b4aa01 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Mon, 29 Aug 2016 15:13:18 -0500 Subject: some python3-specific changes --- tests/bootstrapping.py | 2 +- tests/integration/tests.py | 6 +++--- tests/test_vba.py | 4 ++-- tests/test_vba_battle.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/bootstrapping.py b/tests/bootstrapping.py index b71c19a..a8c2402 100644 --- a/tests/bootstrapping.py +++ b/tests/bootstrapping.py @@ -2,7 +2,7 @@ Functions to bootstrap the emulator state """ -from setup_vba import ( +from tests.setup_vba import ( vba, autoplayer, ) diff --git a/tests/integration/tests.py b/tests/integration/tests.py index 024feab..e5ca6cd 100644 --- a/tests/integration/tests.py +++ b/tests/integration/tests.py @@ -155,6 +155,9 @@ class BasicTestCase(unittest.TestCase): rom_segment = self.rom[0x112116:0x112116+8] self.assertEqual(rom_segment, "HTTP/1.0") + def test_rom_text_at(self): + self.assertEquals(rom_text_at(0x112116, 8), b"HTTP/1.0") + def test_rom_interval(self): address = 0x100 interval = 10 @@ -186,9 +189,6 @@ class BasicTestCase(unittest.TestCase): addr2 = calculate_pointer_from_bytes_at(0x100, bank=True) self.assertEqual(addr2, 0x2ec3) - def test_rom_text_at(self): - self.assertEquals(rom_text_at(0x112116, 8), "HTTP/1.0") - class TestRomStr(unittest.TestCase): sample_text = "hello world!" sample = None diff --git a/tests/test_vba.py b/tests/test_vba.py index 461cb65..a5f7589 100644 --- a/tests/test_vba.py +++ b/tests/test_vba.py @@ -5,13 +5,13 @@ from __future__ import print_function import unittest -from setup_vba import ( +from tests.setup_vba import ( vba, autoplayer, keyboard, ) -from bootstrapping import ( +from tests.bootstrapping import ( bootstrap, bootstrap_trainer_battle, ) diff --git a/tests/test_vba_battle.py b/tests/test_vba_battle.py index c6debc3..5664392 100644 --- a/tests/test_vba_battle.py +++ b/tests/test_vba_battle.py @@ -4,7 +4,7 @@ Tests for the battle controller import unittest -from setup_vba import ( +from tests.setup_vba import ( vba, autoplayer, ) -- cgit v1.2.3