From 1961b069f8a1df58b6b985a7075aabc0280ee37c Mon Sep 17 00:00:00 2001 From: Charles Milette Date: Wed, 18 Jul 2018 23:50:30 -0400 Subject: [PATCH] Fix unit tests on Windows (bad forward slashes assumptions) --- pokemonterminal/database.py | 7 +++---- pokemonterminal/wallpaper/adapters/win32.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pokemonterminal/database.py b/pokemonterminal/database.py index b7171e1..a50fb55 100644 --- a/pokemonterminal/database.py +++ b/pokemonterminal/database.py @@ -209,7 +209,7 @@ class Database: def __load_data(self): # Load all the Pokemon data. This does not include the 'Extra' Pokemon. - with open(self.directory + "/./Data/pokemon.txt", 'r') as data_file: + with open(os.path.join(self.directory, "Data", "pokemon.txt"), 'r') as data_file: # Load everything but the Pokemon from the 'Extra' folder. for i, line in enumerate(data_file): identifier = int(i) + 1 @@ -220,8 +220,7 @@ class Database: pkmn_type_snd = pkmn_data[3] if len(pkmn_data) >= 4 else "" identifier = '{:03}'.format(identifier) region = self.__determine_region(identifier) - path = self.__determine_folder(identifier) + "/" + identifier\ - + ".jpg" + path = os.path.join(self.__determine_folder(identifier), f"{identifier}.jpg") pokemon = Pokemon(identifier, name, region, path, pkmn_type, pkmn_type_snd, dark_threshold) self.__pokemon_type_dictionary[pkmn_type].append(pokemon) @@ -282,4 +281,4 @@ class Database: "unova": "V - Unova", "kalos": "VI - Kalos"} suffix = suffix_dict.get(self.__determine_region(identifier)) - return "{}/Images/Generation {}".format(self.directory, suffix) + return os.path.join(self.directory, "Images", f"Generation {suffix}") diff --git a/pokemonterminal/wallpaper/adapters/win32.py b/pokemonterminal/wallpaper/adapters/win32.py index cc57237..dda459d 100644 --- a/pokemonterminal/wallpaper/adapters/win32.py +++ b/pokemonterminal/wallpaper/adapters/win32.py @@ -3,7 +3,7 @@ import sys from . import WallpaperProvider as _WProv from ctypes import * -class WindowsProvider(_WProv): +class Win32Provider(_WProv): __SPI_SETDESKWALLPAPER = 20 def change_wallpaper(path: str):