Skip to content

Commit

Permalink
Rename a bunch of things.
Browse files Browse the repository at this point in the history
  • Loading branch information
gwax committed Mar 6, 2016
1 parent 1b9492a commit 6412741
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions mtg_ssm/serialization/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Ensure that all serializers are imported to properly set up interface."""
import mtg_ssm.serialization.interface
import mtg_ssm.serialization.csv_serializer
import mtg_ssm.serialization.xlsx_serializer
import mtg_ssm.serialization.csv
import mtg_ssm.serialization.xlsx
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions tests/mtgjson/gen_testdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import json
import os

from mtg_ssm.mtgjson import downloader
from mtg_ssm import mtgjson

TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), 'data')
DATA_DIR = os.path.join(TEST_DATA_DIR, 'source_data')
Expand Down Expand Up @@ -34,9 +34,9 @@
def main():
"""Filter source mtgjson data and dump testdata."""
print('Fetching mtgjson data.')
downloader.fetch_mtgjson(DATA_DIR)
mtgjson.fetch_mtgjson(DATA_DIR)
print('Reading mtgjson data.')
mtg_data = downloader.read_mtgjson(DATA_DIR)
mtg_data = mtgjson.read_mtgjson(DATA_DIR)

print('Generating testdata.')
testdata = collections.OrderedDict()
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Tests for mtg_ssm.serialization.csv_serializer."""
"""Tests for mtg_ssm.serialization.csv."""

import os
import tempfile

from mtg_ssm.mtg import collection
from mtg_ssm.mtg import models
from mtg_ssm.serialization import csv_serializer
from mtg_ssm.serialization import csv

from tests.mtgjson import mtgjson_testcase

Expand All @@ -30,14 +30,14 @@ def test_header(self):
'copies',
'foils',
]
self.assertEqual(expected, csv_serializer.CSV_HEADER)
self.assertEqual(expected, csv.CSV_HEADER)

def test_row_from_printing(self):
# Setup
self.printing.counts[models.CountTypes.copies] = 3
self.printing.counts[models.CountTypes.foils] = 5
# Execute
csv_row = csv_serializer.row_from_printing(self.printing)
csv_row = csv.row_from_printing(self.printing)
# Verify
expected = {
'set': 'MMA',
Expand All @@ -52,7 +52,7 @@ def test_row_from_printing(self):

def test_rows_from_collection(self):
# Execute
row_generator = csv_serializer.csv_rows_from_collection(self.collection)
row_generator = csv.csv_rows_from_collection(self.collection)
# Verify
rows = list(row_generator)
expected = [
Expand All @@ -77,7 +77,7 @@ def test_write_to_file(self):
# Setup
self.printing.counts[models.CountTypes.copies] = 1
self.printing.counts[models.CountTypes.foils] = 12
serializer = csv_serializer.MtgCsvSerializer(self.collection)
serializer = csv.MtgCsvSerializer(self.collection)
with tempfile.TemporaryDirectory() as tmpdirname:
csvfilename = os.path.join(tmpdirname, 'outfile.csv')

Expand All @@ -103,7 +103,7 @@ def test_read_from_file(self):
'MMA,Thallid,167,370352,'
'fc46a4b72d216117a352f59217a84d0baeaaacb7,3,72\n')
csvfile.flush()
serializer = csv_serializer.MtgCsvSerializer(self.collection)
serializer = csv.MtgCsvSerializer(self.collection)

# Execute
serializer.read_from_file(csvfile.name)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Tests for mtg_ssm.serialization.xlsx_serializer."""
"""Tests for mtg_ssm.serialization.xlsx."""

import datetime as dt
import os
Expand All @@ -10,7 +10,7 @@
from mtg_ssm.mtg import collection
from mtg_ssm.mtg import models
from mtg_ssm.serialization import interface
from mtg_ssm.serialization import xlsx_serializer
from mtg_ssm.serialization import xlsx

from tests.mtgjson import mtgjson_testcase

Expand All @@ -26,7 +26,7 @@ def test_create_all_sets(self):
book = openpyxl.Workbook()
sheet = book.create_sheet()
# Execute
xlsx_serializer.create_all_sets(sheet, self.collection)
xlsx.create_all_sets(sheet, self.collection)
# Verify
rows = [[cell.value for cell in row] for row in sheet.rows]
expected = [
Expand Down Expand Up @@ -62,7 +62,7 @@ def test_create_haverefs(self):
self.collection.id_to_printing[pid] for pid in fem_thallid_ids]
fem_thallids.sort(key=lambda p: p.multiverseid)
# Execute
haverefs = xlsx_serializer.create_haverefs(fem_thallids)
haverefs = xlsx.create_haverefs(fem_thallids)
# Verify
expected = "'FEM'!A2+'FEM'!A3+'FEM'!A4+'FEM'!A5"
self.assertEqual(expected, haverefs)
Expand All @@ -72,7 +72,7 @@ def test_get_refs_basic_land(self):
lea_forest = self.collection.id_to_printing[
'5ede9781b0c5d157c28a15c3153a455d7d6180fa']
# Execute
print_refs = xlsx_serializer.get_other_print_references(lea_forest)
print_refs = xlsx.get_other_print_references(lea_forest)
# Verify
self.assertIsNone(print_refs)

Expand All @@ -81,7 +81,7 @@ def test_get_refs_no_others(self):
rhox = self.collection.id_to_printing[
'536d407161fa03eddee7da0e823c2042a8fa0262']
# Execute
print_refs = xlsx_serializer.get_other_print_references(rhox)
print_refs = xlsx.get_other_print_references(rhox)
# Verify
self.assertIsNone(print_refs)

Expand All @@ -90,7 +90,7 @@ def test_ref_refs_multiple_sets(self):
lea_dark_rit = self.collection.id_to_printing[
'fff0b8e8fea06ee1ac5c35f048a0a459b1222673']
# Execute
print_refs = xlsx_serializer.get_other_print_references(lea_dark_rit)
print_refs = xlsx.get_other_print_references(lea_dark_rit)
# Verify
expected = (
'=IF(\'ICE\'!A2>0,"ICE: "&\'ICE\'!A2&", ","")'
Expand All @@ -103,7 +103,7 @@ def test_get_refs_multiple_variants(self):
'fc46a4b72d216117a352f59217a84d0baeaaacb7']

# Execute
print_refs = xlsx_serializer.get_other_print_references(mma_thallid)
print_refs = xlsx.get_other_print_references(mma_thallid)

# Verify
expected = (
Expand All @@ -129,7 +129,7 @@ def test_create_set_sheet(self):
sheet = book.create_sheet()

# Execute
xlsx_serializer.create_set_sheet(sheet, ice_age)
xlsx.create_set_sheet(sheet, ice_age)

# Verify
rows = [[cell.value for cell in row] for row in sheet.rows]
Expand All @@ -151,7 +151,7 @@ def test_write_to_file(self):
'536d407161fa03eddee7da0e823c2042a8fa0262']
printing.counts[models.CountTypes.copies] = 7
printing.counts[models.CountTypes.foils] = 12
serializer = xlsx_serializer.MtgXlsxSerializer(self.collection)
serializer = xlsx.MtgXlsxSerializer(self.collection)
with tempfile.TemporaryDirectory() as tmpdirname:
xlsxfilename = os.path.join(tmpdirname, 'outfile.xlsx')

Expand Down Expand Up @@ -193,7 +193,7 @@ def test_counts_from_sheet(self):
sheet.append(['A', 'B', 'C'])
sheet.append([1, 'B', '=5+7'])
# Execute
row_generator = xlsx_serializer.counts_from_sheet(sheet)
row_generator = xlsx.counts_from_sheet(sheet)
# Verify
rows = list(row_generator)
expected = [
Expand All @@ -203,7 +203,7 @@ def test_counts_from_sheet(self):

def test_read_from_file_bad_set(self):
# Setup
serializer = xlsx_serializer.MtgXlsxSerializer(self.collection)
serializer = xlsx.MtgXlsxSerializer(self.collection)
workbook = openpyxl.Workbook()
workbook['Sheet'].title = 'BADSET'
with tempfile.TemporaryDirectory() as tmpdirname:
Expand All @@ -216,7 +216,7 @@ def test_read_from_file_bad_set(self):

def test_read_from_file(self):
# Setup
serializer = xlsx_serializer.MtgXlsxSerializer(self.collection)
serializer = xlsx.MtgXlsxSerializer(self.collection)
workbook = openpyxl.Workbook()
sheet = workbook['Sheet']
sheet.title = 'S00'
Expand Down

0 comments on commit 6412741

Please sign in to comment.