Skip to content

Instantly share code, notes, and snippets.

View PritishC's full-sized avatar

Pritish Chakraborty PritishC

View GitHub Profile
@PritishC
PritishC / Astropy_1
Last active August 29, 2015 14:01
Astropy Use Cases
{
"metadata": {
"name": "",
"signature": "sha256:8b4cf238865ad5615983c105ab598a6d2c8021b072e8730e4123054e4b57a1a4"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@PritishC
PritishC / Astropy_2
Last active August 29, 2015 14:01
Playing with coordinate frames.
{
"metadata": {
"name": "",
"signature": "sha256:0b6a4a48de35a6c52ff9aee341fa629dbd6071b9ed5f6b6c82f8a7fd235bd772"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"metadata": {
"name": "",
"signature": "sha256:b63eeaad1baa3086408d88e67a43bff6c163dfff9ef9e24603a49983b3bdcfb0"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@PritishC
PritishC / coords_problem
Last active August 29, 2015 14:05
The Coords Problem
{
"metadata": {
"name": "",
"signature": "sha256:cdd795a8e290c1759315e1e7938601c150ee819597f653bfec2d01bdd9892d34"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@PritishC
PritishC / tatti.html
Last active August 29, 2015 14:06
Movie Rating Exercise Q6
Movie
<table border="1" style="font-size:90%; padding: 1px;border-spacing:
0px; border-collapse: separate">
<tbody><tr border="1"><th style="border-width:
1px; padding: 3px; margin: 4px; border-style: inset; border-color:
gray;">mID</th><th style="border-width: 1px; padding: 3px; margin: 4px;
border-style: inset; border-color: gray;">title</th><th style="border-width: 1px; padding: 3px; margin: 4px; border-style:
inset; border-color: gray;">year</th><th style="border-width: 1px;
padding: 3px; margin: 4px; border-style: inset; border-color:
gray;">director</th></tr>
@PritishC
PritishC / gist:6a30b2ceda5209a2fb98
Created September 26, 2014 12:49
Testing endicia_mailclass for readonly-ness.
endicia_mailclass, = self.endicia_mailclass.search([])
self.endicia_mailclass.write([endicia_mailclass], {
'name': 'None'
})
@PritishC
PritishC / gist:09c9b6b502fd0fa25dfa
Created September 29, 2014 07:33
Testing endicia:carrier.py
def test_get_rates(self):
"""
Test the get_rates method of Carrier.
"""
with Transaction().start(DB_NAME, USER, context=CONTEXT) as tr:
tr.set_context(sale=self.sale)
print(self.carrier.get_rates())
Stack Trace:
ERROR: test_get_rates (tests.test_carrier.CarrierTestCase)
@PritishC
PritishC / gist:5770b88608389d594043
Created September 29, 2014 09:25
endicia:carrier.py:get_rates() method None problem
Code:
with Transaction().start(DB_NAME, USER, context=CONTEXT) as tr:
self.setup_defaults()
sale = self.create_sale(self.sale_party)
tr.set_context(sale=sale)
self.carrier.get_rates()
Partial Output:
(u'None Express Mail', Decimal('16.99'), self.currency1, {},
{'endicia_mailclass': 1, 'carrier': 1})
@PritishC
PritishC / gist:3e21ecf7107e974db14f
Created September 30, 2014 06:34
assertRaises Correct
for argument in [
{'name': 'None'},
{'value': 'Value'},
{'method_type': 'international'}
]:
self.assertRaises(
UserError, self.endicia_mailclass.write,
[endicia_mailclass], argument
)
#!/bin/env python
""" tryton_shell: A dirty shell for Tryton to quickly interact with it
usage: tryton_shell.py [-h] --config CONFIG --database DATABASE
arguments:
--config CONFIG Tryton config file.
--database DATABASE Tryton database.