Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 18 adamrp #22

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions qiita_db/backends/sql/tests/test_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env python
from __future__ import division

__author__ = "Adam Robbins-Pianka"
__copyright__ = "Copyright 2013, The Qiita project"
__credits__ = ["Adam Robbins-Pianka"]
__license__ = "BSD"
__version__ = "0.1.0-dev"
__maintainer__ = "Adam Robbins-Pianka"
__email__ = "[email protected]"

from unittest import TestCase, main
from qiita_core.metadata_map import MetadataMap
from string import isdigit

class UtilTests(TestCase):

def setUp(self):
pass


def test_quote_column_name(self):
"""Tests proper lower-casing and double-quoting of input string
"""
self.assertEqual(quote_column_name('HeLlo'), '"hello"')


def test_quote_data_value(self):
"""Tests proper single-quoting of input string
"""
self.assertEqual(quote_data_value('HElLO'), "'HElLO'")


def test_get_datatypes(self):
"""Tests proper inferral of datatypes from a MetadataMap object
"""
pass
5 changes: 4 additions & 1 deletion qiita_db/backends/sql/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ def quote_data_value(c):


def get_datatypes(metadata_map):
""""""
"""Infers datatypes for columns in a metadata_map object

Input is a qiita_core.metadata_map.MetadataMap object
"""
isdigit = str.isdigit
datatypes = []
for header in metadata_map.CategoryNames():
Expand Down
13 changes: 1 addition & 12 deletions qiita_db/interfaces/optparse/config/add_mapping_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,13 @@
Action='store_true',
Handler=None,
ShortName='d',
# Name='clear_tables', # implied by Parameter
# Required=False, # implied by Parameter
# Help='Deletes all rows from column_tables for this study,
# and drops the study's table', # implied by Parameter
# Default=False, # implied by Parameter
# DefaultDescription=None, # implied by Parameter
),
OptparseOption(Parameter=cmd_in_lookup('metadata_map'),
Type='existing_filepath',
Action='store',
Handler=load_mapping_file,
ShortName='m',
# Name='mapping_file_info', # implied by Parameter
# Required=True, # implied by Parameter
# Help='Mapping information to add to the storage. Format
# is (study id, dict of dicts, list of column headers,
# columns datatypes)', # implied by Parameter
),
)
]

outputs = []